Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django : Syncdb incorrectly warns that many-to-many field is stale

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?

like image 660
Neo Avatar asked Apr 01 '11 08:04

Neo


1 Answers

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()
like image 57
Daniel Roseman Avatar answered Sep 22 '22 11:09

Daniel Roseman