#30640: createsuperuser faces error when there is a custom user model with
required
field with the name same as command default options
------------------------------------------+------------------------
Reporter: Hasan Ramezani | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
If we have a `User` model like this:
{{{
class User(AbstractUser):
database = models.CharField(max_length=20)
REQUIRED_FIELDS = ['database']
}}}
When we run `python manage.py createsuperuser`, we will get this error:
`argparse.ArgumentError: argument --database: conflicting option string:
--database`.
Because of `createsuperuser` adds a `--database` option by default and
also `database` is a required field of `User` model and command tries to
add `--database` again.
Possible solution: add a prefix to fields which already added by
`createsupperuser`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30640>
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/052.c1f38c933334b0cc2faf33927329a37a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.