Django 1.8. You must add an additional field to the user account. I am trying to make two different examples http://dunmaksim.blogspot.ru/2015/05/django-18.html and http://www.ruspython.com/blog/izuchaem-django-i-angularjs-1-rasshiryaem -vstroennuyu-model-user / But it turns out some nonsense: there are standard tables auth _... and appear for the custom model, but the lists of users in them are different. How to make it so that everywhere (when logging into the admin panel, when displaying the list of users in the admin panel, when creating createsuperuser, etc.), the same users are used?

Update: I try to do it through creating my own UserProfile model with User fields and an additional field. Based on this instruction (part 1) http://www.odmin4eg.ru/tag/django-registration/ I did it by example, but nothing has changed in the admin area. The table in the database was created.

    1 answer 1

    Option 1, old (previously there was a problem with changing the standard user): create your own MyUser model, which has to add a field like OneToOneField to the standard user (lies in settings.AUTH_USER_MODEL). Consider that these are different models, simply related. And it is necessary to monitor the integrity of the data (the fact that User is tied to MyUser is a fact, and the fact that User-> MyUser is no longer).

    Option 2: create your own model, inheriting from AbstractBaseUser (just the first 2 links from your question). Do not forget to register it in settings (AUTH_USER_MODEL, as well as add it to installed applications). Official documentation (the fragment is not translated in the Russian documentation) warns that this should be done before the first call of the "migrate" command and the creation of migrations. Otherwise, you have to edit everything manually. If the project is new, you can simply delete the database and re-create - perhaps this is your problem.