Opened 12 years ago
Closed 12 years ago
#19925 closed Cleanup/optimization (fixed)
Models validator should check if UserModel.REQUIRED_FIELDS is list
Reported by: | RomanAlexander | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | django@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Pull request with patch here.
I spent some time debugging django-admin.py createsuperuser raising optparse.OptionConflictError.
I forgot to make REQUIRED_FIELDS custom user model a list. This validation error should help others avoid my mistake.
Change History (4)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
Cc: | added |
---|
I created the pull request https://github.com/django/django/pull/876 to fix this.
comment:3 by , 12 years ago
Crap, sorry, I just realized that there was another pull request by the reporter as well. And it looks like we solved it just about the same way. The only differences that I see are that I check that REQUIRED_FIELDS is a list/tuple before checking that cls.USERNAME is not in the list, which may be preferable. I also added tests for the change to the same places the other two AUTH_USER_MODEL validation issues.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sounds like a sensible addition.