django customize the user model

  1. Create a new model that inherits from AbstractBaseUser.
  2. Define the required fields such as email and username as unique.
  3. Set the USERNAME_FIELD and REQUIRED_FIELDS in the new model.
  4. Create a new manager for the model that uses the UserManager class.
  5. Override the create_user and create_superuser methods in the manager.
  6. Update the AUTH_USER_MODEL setting in the settings.py file.
  7. Make and apply the migrations to create the new user model.