#28594: Value error on related user name during save of user model
-------------------------------------+-------------------------------------
     Reporter:  Axel Rau             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.auth         |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:  Value error, user    |             Triage Stage:  Accepted
  model, normalize_username          |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Melvyn Sopacua):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * needs_docs:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 At the very least this should use `six.string_types` on 1.x branches. But
 I think this is a documentation issue. If you change the type of the
 username field, then you should reimplement normalize_username or prevent
 it being called.
 However, Django's documentation says:

         :attr:`USERNAME_FIELD` now supports
         :class:`~django.db.models.ForeignKey`\s. Since there is no way to
 pass
         model instances during the :djadmin:`createsuperuser` prompt,
 expect the
         user to enter the value of
 :attr:`~django.db.models.ForeignKey.to_field`
         value (the :attr:`~django.db.models.Field.primary_key` by default)
 of an
         existing instance.

 The current behavior of `clean()` and `UserManager._create_user()` does
 not support foreign keys as it should expect to be handed model instances
 and not call `normalize_username` or as the patch suggests,
 `normalize_username` should only act on strings.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28594#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.09719b1beeaf2b76f24513cd395becf6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to