Code

#19411 closed Cleanup/optimization (invalid)

Fully featured User model with admin-compliant permissions without username

Reported by: michal@… 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

Attachments (0)

Change History (1)

comment:1 Changed 17 months ago by ptone

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.