Opened 14 years ago
Closed 14 years ago
#15977 closed Bug (needsinfo)
ChoiceField breaks if value is None
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.3 |
Severity: | Normal | Keywords: | form clean validate |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
https://github.com/django/django/blob/master/django/forms/fields.py#L676
If the value of a ChoiceField is None (ie. it was set programmatically from something other than an HTML request and that value was not entered) then this will throw a TypeError instead of creating a proper ValidationError. Perhaps change it to "{'value':value or 'None'}" to avoid this?
Note:
See TracTickets
for help on using tickets.
Please provide at least a snippet of code to demonstrate the problem. It is not obvious when looking at the fields.py code.