#29019: createsuperuser crashes if a ManyToManyField is in REQUIRED_FIELDS
------------------------------+-------------------------------------------
     Reporter:  James Kirsop  |                    Owner:  Williams Mendez
         Type:  Bug           |                   Status:  assigned
    Component:  contrib.auth  |                  Version:  2.0
     Severity:  Normal        |               Resolution:
     Keywords:  user custom   |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+-------------------------------------------

Comment (by Lenno Nagel):

 Hi!

 We explored a couple of ideas regarding this during DjangoCon Europe 2018.

 The aspect that blocks implementation is the create_superuser function in
 the default UserManager class that has no support for M2M field data
 present in **kwargs. Such data would have to be extracted from kwargs and
 handled after the user.save(..) call, however we did not feel comfortable
 with proposing code for this solution without prior discussion.

 It was found that it is perhaps best simply to warn the user whenever M2M
 fields have been added to REQUIRED_FIELDS and suggest that in this case, a
 custom user manager must also be written that handles the data properly.
 We could not find a safe way to detect whether the default manager has
 been overridden or whether it would handle the M2M field in the
 create_superuser function, so this warning has to be marked as ignored
 manually by the user.

 A proposed solution:
 https://github.com/django/django/pull/9990

 Regards,
 Lenno

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29019#comment:5>
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/069.705b596dd7b4350ad47e8fd21b6f8a44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to