我有一个 Django 应用程序,其中一个应用程序与 UserProfile 具有多对多关系。但是每当我执行 syncdb 时,它都会警告我 app_users 是陈旧的字段
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)
现在我不在 View 内使用 UserProfile,除非在规则内用于某些身份验证目的。并且 UserProfile 只能从管理界面附加到应用程序。我怎样才能阻止 django syncdb 给我这个错误/不正确的警告?
最佳答案
注意消息。这并不是说您的领域已经过时 - 它是在谈论 Content Types 中的一个条目模型。
在 shell 中,执行此操作:
from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get(app_label='Apps', model='app_users')
ct.delete()
关于python - Django : Syncdb incorrectly warns that many-to-many field is stale,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5510843/