#36225: createsuperuser validation breaks if USERNAME_FIELD is distinct but user
manager deliberately lacks get_by_natural_key()
--------------------------------+---------------------------------------
     Reporter:  Jonas Dittrich  |                    Owner:  Joe Babbitt
         Type:  Bug             |                   Status:  assigned
    Component:  contrib.auth    |                  Version:  5.1
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+---------------------------------------
Changes (by Joe Babbitt):

 * has_patch:  0 => 1

Comment:

 Patch has been submitted via GitHub. My approach was to copy what we do
 with `username_is_unique` and create a cached_property. I think the cached
 bit is a fair trade-off, especially helping folks who don't implement
 natural keys since [https://stackoverflow.com/questions/903130/hasattr-vs-
 try-except-block-to-deal-with-non-existent-attributes it appears] the
 negative result of a `has_attr` lookup is slower than a positive result.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36225#comment:13>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019e41800be6-44666e72-ff61-43d8-b4ae-86cad795851b-000000%40eu-central-1.amazonses.com.

Reply via email to