Opened 13 years ago

Closed 13 years ago

#15977 closed Bug (needsinfo)

ChoiceField breaks if value is None

Reported by: adam@… 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?

Change History (1)

comment:1 by Claude Paroz, 13 years ago

Resolution: needsinfo
Status: newclosed

Please provide at least a snippet of code to demonstrate the problem. It is not obvious when looking at the fields.py code.

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