Opened 12 years ago
Closed 12 years ago
#19411 closed Cleanup/optimization (invalid)
Fully featured User model with admin-compliant permissions without username
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.auth | Version: | 1.5-beta-1 |
Severity: | Normal | Keywords: | AbstractUser |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I wanted to create a simple user Model with admin-compliant permissions so I used AbstractUser then I created my UserManager for that.
I don't need a username field in my User model. Why the AbstractUser class have username, first_name and last_name fields?
https://github.com/django/django/blob/stable/1.5.x/django/contrib/auth/models.py#L300
Are they required to admin-compliant permissions functionality?
Would be a better idea to move that fields in to User class?
https://github.com/django/django/blob/stable/1.5.x/django/contrib/auth/models.py#L447
There are a number of layers of abstraction, the basic requirements are laid out here:
https://docs.djangoproject.com/en/dev/topics/auth/#specifying-a-custom-user-model
If you choose to extend AbstractUser you take on even more default configuration of your user model
https://docs.djangoproject.com/en/dev/topics/auth/#extending-django-s-default-user
If you can point to a specific unclear point in the docs - please reopen.