Opened 7 years ago

Closed 7 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: master
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


Pull request with patch here.

I spent some time debugging 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 Changed 7 years ago by Florian Apolloner

Triage Stage: UnreviewedAccepted

Sounds like a sensible addition.

comment:2 Changed 7 years ago by Chris Streeter

Cc: django@… added

I created the pull request to fix this.

comment:3 Changed 7 years ago by Chris Streeter

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 Changed 7 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 69373f3420d28597332a72269b5fae721cc6ae19:

Fixed #19925 - Added validation for REQUIRED_FIELDS being a list

Thanks Roman Alexander for the suggestion.

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