O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required