Opened 4 years ago

Closed 4 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, 4 years ago

Type: UncategorizedBug

comment:2 by Mariusz Felisiak, 4 years ago

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

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

comment:3 by Yan Mitrofanov, 4 years ago

Owner: changed from nobody to Yan Mitrofanov
Status: newassigned

comment:4 by Mariusz Felisiak, 4 years ago

Has patch: set

comment:5 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

In b88f9873:

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

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