Opened 12 years ago

Closed 12 years ago

#17327 closed New feature (fixed)

contrib.auth management commands ignores --database option

Reported by: skam <massimo.scamarcia@…> Owned by: Brian Riley
Component: contrib.auth Version: 1.3
Severity: Release blocker Keywords: django db models createsuperuser management
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

I am using multiple database support with a database router to switch the current database to provide different data based on the current request. I need also to separate user tables for each db and create a superuser for it, but createsuperuser management command ignores the "--database" option that I use often with "syncdb" and migration tools such as South:

$ python manage.py createsuperuser --database="test_database"
Usage: manage.py createsuperuser [options] 

Used to create a superuser.

manage.py: error: no such option: --database

Attachments (3)

createsuperuser-database-option.diff (5.6 KB ) - added by Brian Riley 12 years ago.
auth-management-commands-database-option.diff (11.6 KB ) - added by Brian Riley 12 years ago.
Patch to add --database option to both createsuperuser and change password management commands
createsuperuser-multidb-tests-moved.diff (5.3 KB ) - added by Brian Riley 12 years ago.
Moves multi DB tests for createsuperuser to regressiontests

Download all attachments as: .zip

Change History (13)

comment:1 by Preston Holmes, 12 years ago

Component: Core (Management commands)contrib.auth
Summary: createsuperuser management command ignores --database optioncontrib.auth management commands ignores --database option
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

comment:2 by Brian Riley, 12 years ago

Owner: changed from nobody to Brian Riley
Status: newassigned

by Brian Riley, 12 years ago

comment:3 by Brian Riley, 12 years ago

Has patch: set

by Brian Riley, 12 years ago

Patch to add --database option to both createsuperuser and change password management commands

comment:4 by Preston Holmes, 12 years ago

did you note that I changed the summary - it would seem beneficial to fix this for both of the auth management commands - including changepassword

However this patch is still good - would you be willing to expand?

comment:5 by Brian Riley, 12 years ago

I did notice the summary change. The second patch I uploaded covers both createsuperuser and changepassword. The first patch can be ignored.

comment:6 by Jannis Leidel, 12 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Chris Beaven, 12 years ago

Resolution: fixed
Status: assignedclosed

In [17665]:

Fixes #17327 -- Add --database option to createsuperuser and change password management commands

by Brian Riley, 12 years ago

Moves multi DB tests for createsuperuser to regressiontests

comment:8 by Brian Riley, 12 years ago

Resolution: fixed
Status: closedreopened

Seems like most multi DB management commands are in regressiontests, so I moved the createsuperuser tests there. This will ensure that they aren't run when you run the tests on your Django project.

comment:9 by Claude Paroz, 12 years ago

Severity: NormalRelease blocker

comment:10 by Ramiro Morales, 12 years ago

Resolution: fixed
Status: reopenedclosed

In [17676]:

Fixed #17327 (again) -- Moved createsuperuser tests added in r17665.

In their new location they won't cause multi-db-related errors when
users run contrib.auh tests together with their application tests.

Thanks brianriley for the patch.

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