D
D
Danil Valiulin2016-01-30 06:39:23
Django
Danil Valiulin, 2016-01-30 06:39:23

How to solve errors while extending the User model?

I tried to extend the User model according to my needs.
Model

class MyUser(AbstractUser):
    height = models.IntegerField(verbose_name=u'Рост', blank=True)

Settings ForeignKey in models Error during migration
AUTH_USER_MODEL = 'base.MyUser'
user = models.ForeignKey(settings.AUTH_USER_MODEL)
ValueError: Lookup failed for model referenced by field base.BodySize.user: base.MyUser

If you delete all migration files and make a migration, then the error is
django.db.utils.ProgrammingError: (1146, “Table 'cachalka.base_myuser_user_permissions' doesn't exist”)

I tried to do it on a clean database with the removal of all migration files, but then django does not create the django_session table. Mistake
“Table 'c_test.django_session' doesn't exist”.

Please tell me how to be.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-01-30
@Balalay12

https://docs.djangoproject.com/en/1.9/topics/migra...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question