Substituting a custom user model
Some kinds of projects may have authentication requirements for which Django's built-in User
model is not always appropriate. For instance, on some sites it makes more sense to use an email address as your identification token instead of a username. Django allows you to override the default User model by providing a value for the AUTH_USER_MODEL
setting that references a custom model:
AUTH_USER_MODEL = 'books.MyUser'
This dotted pair describes the name of the Django app (which must be in your INSTALLED_APPS
), and the name of the Django model that you wish to use as your User model.
Note
Changing AUTH_USER_MODEL
has a big effect on your Django project, particularly your database structure. For example, if you change ...
Get Mastering Django: Core now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.