Django:Syncdb错误地警告多对多字段是陈旧的 [英] Django : Syncdb incorrectly warns that many-to-many field is stale

查看:139
本文介绍了Django:Syncdb错误地警告多对多字段是陈旧的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个django应用程序,其中一个应用程序与UserProfile具有多对多的关系。但是每当我做一个syncdb,它会警告我app_users是陈旧的字段

 以下内容类型是陈旧的,需要删除:
应用程序| app_users

#settings.py
AUTH_PROFILE_MODULE ='kprofile.UserProfile'

#Apps / models.py
class app(models.Model):
....
users = models.ManyToManyField(UserProfile)

现在我不使用UserProfile里面的视图,除了一些身份验证目的在规则内。 UserProfile只能从管理界面附加到应用程序。如何停止django syncdb给我这个错误/不正确的警告?

解决方案

请注意该消息。这并不是声称你的领域是陈旧的 - 它正在谈论内容中的条目类型模型。



在shell中,执行以下操作:

  from django.contrib.contenttypes.models import ContentType 
ct = ContentType.objects.get(app_label ='Apps',model ='app_users')
ct.delete()


I have a django application where one application has many-to-many relationship with a UserProfile. But whenever I do a syncdb, it warns me that app_users is stale field

The following content types are stale and need to be deleted:
     Apps | app_users

#settings.py
AUTH_PROFILE_MODULE = 'kprofile.UserProfile'

#Apps/models.py
class app(models.Model):
    ....
    users = models.ManyToManyField(UserProfile)

Now I don't use UserProfile inside view except for some authentication purposes inside rules. And a UserProfile can be attached to an App only from admin interface. How can I stop django syncdb from giving me this false/incorrect warning?

解决方案

Pay attention to the message. It's not claiming that your field is stale - it's talking about an entry in the Content Types model.

In the shell, do this:

from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get(app_label='Apps', model='app_users')
ct.delete()

这篇关于Django:Syncdb错误地警告多对多字段是陈旧的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆