#24370: Recommend that all new projects use a custom user model
------------------------------------------------+------------------------
               Reporter:  carljm                |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Documentation         |        Version:  1.7
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 Right now, our custom user model docs are buried deep in the auth-
 customization docs, and are a bit intimidating - because it assumes that
 you would only need a custom user model if making significant departures
 from the default User, the examples used require a fair amount of
 boilerplate, and there are several big scary warning callouts. I've dealt
 with many people in #django in a position where they needed a custom user
 model, but had already launched the project without one, leaving them with
 no good options. Several of these people specifically said that they'd
 considered using a custom user model initially, but were scared off by the
 docs.

 Every single new Django project, even if it doesn't initially need
 anything different from the default user model, should start with a two-
 line custom user model like this:

 {{{
 from django.contrib.auth.models import AbstractUser

 class User(AbstractUser):
     pass
 }}}

 It's trivial to setup, there is no downside, and there is massive upside:
 later in the project, when you realize that you need unique emails, or an
 additional field, or some other departure from the default, it's easy to
 use migrations to modify an existing custom user model. It's extremely
 difficult to migrate from the default user model to a custom user model.

 (Ironically, the warnings in the documentation that scare people away from
 starting with a custom user model are all about problems with switching to
 one mid-stream; problems that would be totally avoided if people did start
 off with a custom user model!)

 My proposal: we reorganize the "Customizing Authentication" page to
 recommend and feature the super-simple custom user model as shown above.
 We also link to that page from the tutorial with a recommendation to start
 your real project with a custom user model. (I don't know that we should
 actually modify the tutorial code, as that's a bit of additional
 complexity, but I think people should at least be encouraged to go look at
 the auth-customization docs.)

--
Ticket URL: <https://code.djangoproject.com/ticket/24370>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.696d7f26ef0a34d14a863ec6dc3fb79f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to