Opened 8 years ago
Last modified 7 years ago
#28310 closed Bug
(form) RangeFields should handle (None, None) better. — at Initial Version
Reported by: | Matthew Schinckel | Owned by: | nobody |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When you clean a RangeField, and pass it in (, ), or (None, None), it falls through to the MultiValueField handling, which, when all values are empty, treats the cleaned value as empty.
https://github.com/django/django/blob/master/django/forms/fields.py#L992
Thus:
FloatRangeField().clean([None, None])
returns None
, when it really should return FloatRange(None, None).
There is a very large difference between these.
Note:
See TracTickets
for help on using tickets.