#33122: createsuperuser fails when using USERNAME_FIELD
-------------------------------------+-------------------------------------
Reporter: Raymond Olavides | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 3.2
Severity: Normal | Resolution: invalid
Keywords: createsuperuser, | Triage Stage:
command-line utility | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* status: new => closed
* resolution: => invalid
Comment:
This appears to be a usage mistake. You need to use a custom manager with
your user model that defines
[https://docs.djangoproject.com/en/stable/topics/auth/customizing/#django.contrib.auth.models.CustomUserManager.create_superuser
create_superuser()] with appropriate parameters (corresponding to your
`USERNAME_FIELD`.
For an example of how this works, you can look at Django's
[https://github.com/django/django/blob/32b7ffc2bbfd1ae055bdbe287f8598de731adce1/tests/auth_tests/test_management.py#L335
test] for `createsuperuser` which uses
[https://github.com/django/django/blob/32b7ffc2bbfd1ae055bdbe287f8598de731adce1/tests/auth_tests/models/custom_user.py
a custom user] that defines `REQUIRED_FIELDS`.
--
Ticket URL: <https://code.djangoproject.com/ticket/33122#comment:2>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/067.f4ee9e32bef836134dd5f82eb3beef17%40djangoproject.com.