createsuperuser fails when custom user model has no username
|Reported by:||Ian Clelland||Owned by:||Ian 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
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 5 years ago by
|Owner:||changed from nobody to Ian Clelland|
comment:3 Changed 5 years ago by
|Component:||contrib.auth → Documentation|
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|