#12667 closed (fixed)
changeset:12098 introduces choice validation bug at the model level
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Lines 200-202 of django/db/models/fields/init.py (introduced in changeset:12098) improperly handle the validation of choice fields.
if self._choices and value: if not value in dict(self.choices): raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)
This block does not account for grouped choices as described in the docs.
See the valid_value method of the ChoiceField class in /django/forms/fields.py for reference.
Attachments (2)
Change History (6)
by , 15 years ago
Attachment: | 12667.diff added |
---|
comment:1 by , 15 years ago
Has patch: | set |
---|---|
milestone: | → 1.2 |
Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
Attachment: | 12667.2.diff added |
---|
comment:2 by , 15 years ago
I tested the second patch with my code and believe the problem is solved. Thank you, Ramiro. - Thomas B. Higgins
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Correct patch. previous fix and test were totally bogus.