When running `./manage.py createsupseruser` it prompts correctly for just
email and password (in response to `REQUIRED_FIELDS` being set correctly).
However, when trying to create the superuser it spits out `TypeError:
create_superuser() missing 1 required positional argument: 'username'` in
line 75 of `/contrib/auth/management/commands/createsuperuser.py`.
The error happens because in `contrib/auth/models` in the
`create_superuser` and `create_user` function it's requiring username and
email to be passed in but the createsuperuser command is only passing in
email because username is not in the `REQUIRED_FIELDS`.
This seems like a bug in Django to me. Would this be open to a pull
request? There are 2 ways I see to fix this, and am very open to
recommendation if this is in deed a bug and open to a pull request.
#1 default username and email to None in the manager functions
#2 if email or username are not defined in `user_data` in
createsuperuser.py, add those to the dict as `None` before passing to the
create_superuser function.
I am seeing this in django 1.9.4 and have also seen it in previous
versions of django
--
Ticket URL: <https://code.djangoproject.com/ticket/26412>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26412#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
If you read carefully the paragraphs above and below
https://docs.djangoproject.com/en/stable/topics/auth/customizing/#django.contrib.auth.models.CustomUserManager,
you will see that you are required to provide your own manager class for
your custom user model (with `create_user`/`create_superuser` methods).
Please reopen if I missed anything.
--
Ticket URL: <https://code.djangoproject.com/ticket/26412#comment:2>