Opened 6 years ago

Closed 6 years ago

#31878 closed Bug (fixed)

Default username in createsuperuser command doesn't respect the --database option.

Reported by: Yan Mitrofanov Owned by: Yan Mitrofanov
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (6)

comment:1 by Yan Mitrofanov, 6 years ago

Type: Uncategorized → Bug

comment:2 by Mariusz Felisiak, 6 years ago

Summary: Default username in "createsuperuser" command is always validated in the default database → Default username in createsuperuser command doesn't respect the --database option.
Triage Stage: Unreviewed → Accepted
Version: 2.2 → master

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

comment:3 by Yan Mitrofanov, 6 years ago

Owner: changed from nobody to Yan Mitrofanov
Status: new → assigned

comment:4 by Mariusz Felisiak, 6 years ago

Has patch: set

comment:5 by Mariusz Felisiak, 6 years ago

Triage Stage: Accepted → Ready for checkin

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

Resolution: → fixed
Status: assigned → closed

In b88f9873:

Fixed #31878 -- Made createsuperuser respect --database option in default usernames.

Note: See TracTickets for help on using tickets.
Back to Top