[Django] #31878: Default username in "createsuperuser" command is always validated in the default database

9 views
Skip to first unread message

Django

unread,
Aug 12, 2020, 6:58:09 AM8/12/20
to django-...@googlegroups.com
#31878: Default username in "createsuperuser" command is always validated in the
default database
------------------------------------------+------------------------
Reporter: Yan Mitrofanov | Owner: nobody
Type: Uncategorized | 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 |
------------------------------------------+------------------------
The **createsuperuser** command in interactive mode suggests to leave
username blank and use the default name
(django.contrib.auth.management.get_default_username). The default name is
validated to not be already used by an another user. This validation
executes a query on User model using default database and not using the
database option passed to the command.

This is the problem when you are using multiple databases.

--
Ticket URL: <https://code.djangoproject.com/ticket/31878>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 12, 2020, 6:58:52 AM8/12/20
to django-...@googlegroups.com
#31878: Default username in "createsuperuser" command is always validated in the
default database
--------------------------------+--------------------------------------

Reporter: Yan Mitrofanov | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 2.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Yan Mitrofanov):

* type: Uncategorized => Bug


--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:1>

Django

unread,
Aug 12, 2020, 7:12:08 AM8/12/20
to django-...@googlegroups.com
#31878: Default username in createsuperuser command doesn't respect the --database
option.
--------------------------------+------------------------------------

Reporter: Yan Mitrofanov | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by felixxm):

* version: 2.2 => master
* stage: Unreviewed => Accepted


Comment:

Agreed, we should pass `database` to the `get_default_username()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:2>

Django

unread,
Aug 13, 2020, 5:35:14 AM8/13/20
to django-...@googlegroups.com
#31878: Default username in createsuperuser command doesn't respect the --database
option.
--------------------------------+------------------------------------------
Reporter: Yan Mitrofanov | Owner: Yan Mitrofanov
Type: Bug | Status: assigned

Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Yan Mitrofanov):

* owner: nobody => Yan Mitrofanov
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:3>

Django

unread,
Aug 13, 2020, 7:16:36 AM8/13/20
to django-...@googlegroups.com
#31878: Default username in createsuperuser command doesn't respect the --database
option.
--------------------------------+------------------------------------------
Reporter: Yan Mitrofanov | Owner: Yan Mitrofanov
Type: Bug | Status: assigned
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/13301 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:4>

Django

unread,
Aug 14, 2020, 2:23:02 AM8/14/20
to django-...@googlegroups.com
#31878: Default username in createsuperuser command doesn't respect the --database
option.
-------------------------------------+-------------------------------------

Reporter: Yan Mitrofanov | Owner: Yan
| Mitrofanov
Type: Bug | Status: assigned
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:5>

Django

unread,
Aug 14, 2020, 5:46:05 AM8/14/20
to django-...@googlegroups.com
#31878: Default username in createsuperuser command doesn't respect the --database
option.
-------------------------------------+-------------------------------------
Reporter: Yan Mitrofanov | Owner: Yan
| Mitrofanov
Type: Bug | Status: closed
Component: contrib.auth | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"b88f98738fbbdf119f4ff001e4eccf72a77d9518" b88f9873]:
{{{
#!CommitTicketReference repository=""
revision="b88f98738fbbdf119f4ff001e4eccf72a77d9518"
Fixed #31878 -- Made createsuperuser respect --database option in default
usernames.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31878#comment:6>

Reply all
Reply to author
Forward
0 new messages