Select a Configuration Method for Improved User
The goal of this package is to improve your project’s User model. To that end, Improved User may be used in three different ways. You may:
inherit
AbstractUser
in your ownUser
model (extension);use the supplied
User
model directly (integration);create your own User model using the supplied model mix-in classes (replacement).
Tip
It is generally considered a good idea to change the User
model as infrequently and as little as possible, given the
possibility of security problems. Creating a Profile
model—which has a foreign key to the User
model—to store
your users’ information can help avoid changes to the User
model.
Extension Method
The extension method is the recommended method to use when configuring
Improved User. Instructions for this method are found in
Quickstart: Using Improved User. This method gives the developer the most control and
flexibility, at the cost of having slightly extra code. This method is
the least likely to cause you problems in the long run, as it grants you
control of the model fields and migrations for your User
model,
and gives you the opportunity of entirely removing Improved User in the
future if you need to.
Integration Method
The integration option is the simplest, and uses the least code.
However, it is also the least flexible, as it assumes that you will
never change the structure of the User
model. While this method may work fine for many, the amount of work
required to deal with any potential future change is very high. In many
ways, it is the most similar to Django’s own
User
: you gain all of the benefits
of the class directly, but forgo the ability to control or remove the
model in the future without serious work. You may refer to
How To: Integrate Improved User Directly to use this method.
Warning
It will always be possible to switch between the extension and replacement methods, but is difficult to migrate to or from the integration method.
Replacement Method
The replacement method comes with the same trade-offs as the extension
method, but should be used in the event any of the fields included in
the AbstractUser
are not
desired. We recommend this method only to those very familiar with
Django. For more information, please refer to
How To: Create a Custom User using Mixins.