createsuperuser fails when custom user model has no username
|Reported by:||clelland||Owned by:||clelland|
|Cc:||django@…, tom@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
There is a dependency in the createsuperuser management command on the existence of a field called 'username' in a user model.
Since #3011 was fixed, user models do not necessarily have that field. They are required to have a single identifying field, which is passed in as the first parameter to their create_superuser() method, but it is not necessarily named username.
As a result, if syncdb installs django.contrib.auth, and the user model does not have a 'username' field, then the creation of the initial superuser will fail.
I have a (one line) patch which fixes this, and will try to get tests written for it later today.
Change History (14)
comment:1 Changed 3 years ago by clelland
- Has patch set
- Needs documentation unset
- Needs tests set
- Owner changed from nobody to clelland
- Patch needs improvement unset
comment:3 Changed 3 years ago by melinath
- Component changed from contrib.auth to Documentation
- Needs documentation set
- Needs tests unset
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted
comment:4 Changed 3 years ago by ptone
- Resolution set to needsinfo
- Status changed from new to closed
comment:8 Changed 3 years ago by ptone
- Resolution needsinfo deleted
- Status changed from closed to reopened