22.3 Custom User
Creating a Profile model is great when we need to add information, but it becomes woefully unhelpful if we want to change or remove information. I am not a fan of the fact that our current implementation uses both a username and an email field on the User model. If we want to use only the email field, we must change the User model itself.
The User model is actually a very thin model that inherits from AbstractUser, where most of the user fields are defined. However, this class in turn inherits from AbstractBaseUser and PermissionsMixin. The AbstractBaseUser defines the heart of the User model, supplying the password and last_login field as well as the methods to interact with the password field. The PermissionsMixin defines ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access