I recently upgraded my Django version to 1.6.2, and I ran into the following problem:
I was extending the auth.AbstractUser class, and I did the following:
#node/models.py
class Person(AbstractUser):
dept = models.ManyToManyField(Department)
#settings.py
AUTH_USER_MODEL = node.Person
#one of the other models had a reference to User:
#node/models.py
class Page(models.Model):
...
owner = User
Before I changed the Page class, I ran `python manage.py makemigrations` and `python manage.py migrate`,
because I didn't know I had to change User to settings.AUTH_USER_MODEL. Now, the db was edited:
.schema node_page_owner
...
"user_id" integer NOT NULL,
...
Now I have made the change in Page class to point owner to `settings.AUTH_USER_MODEL`, but a
`python manage.py migrate` doesn't recognize this change, thereby not changing the column name `user_id`. What should I do now?
-- I was extending the auth.AbstractUser class, and I did the following:
#node/models.py
class Person(AbstractUser):
dept = models.ManyToManyField(Department)
#settings.py
AUTH_USER_MODEL = node.Person
#one of the other models had a reference to User:
#node/models.py
class Page(models.Model):
...
owner = User
Before I changed the Page class, I ran `python manage.py makemigrations` and `python manage.py migrate`,
because I didn't know I had to change User to settings.AUTH_USER_MODEL. Now, the db was edited:
.schema node_page_owner
...
"user_id" integer NOT NULL,
...
Now I have made the change in Page class to point owner to `settings.AUTH_USER_MODEL`, but a
`python manage.py migrate` doesn't recognize this change, thereby not changing the column name `user_id`. What should I do now?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c4f1aa91-3ffa-44b2-a639-6c183dc07d80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment