Opened 11 years ago

Closed 11 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 Florian Apolloner, 11 years ago

Triage Stage: UnreviewedAccepted

Sounds like a sensible addition.

comment:2 by Chris Streeter, 11 years ago

Cc: django@… added

I created the pull request https://github.com/django/django/pull/876 to fix this.

comment:3 by Chris Streeter, 11 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 Tim Graham <timograham@…>, 11 years ago

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