我有一个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)
现在我不在视图中使用UserProfile,除了规则内的一些身份验证目的。并且UserProfile只能从管理界面附加到应用程序。如何阻止django syncdb给我这个错误/不正确的警告?
答案 0 :(得分:20)
注意信息。它没有声称你的领域是陈旧的 - 它正在讨论Content Types模型中的一个条目。
在shell中,执行以下操作:
from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get(app_label='Apps', model='app_users')
ct.delete()