Hi,
I've worked on several apps where users don't have a username, and
instead require a unique email. Every time, I've used a similar custom
user model which extended AbstractBaseUser, PermissionsMixin. I then had
to copy-paste several fields from AbstractUser into my custom user
(either because they're always used, or required by the admin).
There are other hacks, and workarounds for email-based accounts (when a
project doesn't want/need usernames), and I feel that there's room for
improvement here (rather than just recommending some other hack).
Currently, the User class hierarchy is something like
... > AbstractBaseUser > AbstractUser > User
If a project does not want their Users username-based, they need to
extend from AbstractBaseUser (and PermissionsMixin), and copy some
functionality from AbstractUser. This is a pretty common scenario, and a
quick search on SO will prove lots of people come across this scenario.
I'd like to propose moving is_active, is_staff, email_user, and a few
other fields to a Mixin. Then, have AbstractUser extend this mixin too.
This does not affect our current User model, but allows custom user
models to simply extend this mixin and have admin-compatible User right
away.
With this change, and some updates to the documentation, this would
remove a lot of burden for maintainer of custom user models where
system's don't require/want username.
I'm willing to work on this too (especially since this would let me
clean up a lot of custom user models), but I'd like to know if these
changes would be acceptable or not, or if there's any feedback on it
first.
Cheers,
--
Hugo Osvaldo Barrera
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/1441186269.1688715.372548137.5D9044C1%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.