In Django, the default user profile table is created as auth_user. Alternatively, we can create our own customized UserProfile to replace Django default auth_user table.
Define UserProfile Model
After creating the users app, in the models.py file, define the UserProfile model. I will inherit Django’s AbstractUser
from django.db import models |
Configure Settings
In the project settings.py file, add the following
AUTH_USER_MODEL = "users.UserProfile" |
Make migrations and migrate
In the shell, make migrations and migrate
python manage.py makemigrations |
Now, users_userprofile table will replace Django’s default auth_user table as the user management table.