auth's User model should be fully customizable - another way of providing additional information about users
|Reported by:||fas||Owned by:||nobody|
|Severity:||Normal||Keywords:||user email login authentication backend profile|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The current way of adding additional user information is to create a user profile model:
The way this is handled now is very unsatisfying. It makes not much sense to have the fields of the User model fixed/dictated by Django and to have to create a related model to store additional user information. Having multiple tables for basic user information is not the usual way of storing user information and would not be done if it were not for the restriction that Django has.
Another issue new Django users face often: if they want the users to login via e-mail address and not via username, they hit a wall. Custom authentication backends that can be found are all defective, mainly due to the fact that the email field is not declared unique. Monkey patching it is not a great option.
I propose the following solution:
If settings.AUTH_USER_MODEL is defined, this model should be used instead of auth.models.User. This model should inherit from auth.models.User.
This way, one can define all relevant fields to the application (instead of having them in a separate related model) and also redefine the email field to be unique if one wishes to do so.
I think this would be a vastly superior way of adding additional user information.
If settings.AUTH_USER_MODEL is not defined, everything can work as before.
I think this would improve Django's auth contrib module significantly. What do you think?