meaning of get_by_natural_key #7758
-
When I tried to use my model as AUTH_USER_MODEL, I am getting this error:
models.py:
Complete error:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Make sure to add Do this before creating any migrations or running manage.py migrate for the first time.
If still getting the error, follow the steps from this link. |
Beta Was this translation helpful? Give feedback.
-
Here are few things you may try:
|
Beta Was this translation helpful? Give feedback.
Make sure to add
AUTH_USER_MODEL = 'myapp.MyUser'
in settings.py of the Django project.Here,
myapp
is the name of that Django app (which must be in your INSTALLED_APPS) andMyUser
is the name of the Django model that you wish to use as your user model.Do this before creating any migrations or running manage.py migrate for the first time.
and make sure to register the model in the app’s admin.py :-
If still getting the error, follow the steps from this link.