Opened 7 years ago

Closed 7 years ago

#28310 closed Bug (needsinfo)

form RangeFields should treat (None, None) as Range(None, None) rather than None

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 (last modified by Tim Graham)

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.

Thus, FloatRangeField().clean([None, None]) returns None, when it really should return FloatRange(None, None).

There is a very large difference between these.

Change History (2)

comment:1 by Tim Graham, 7 years ago

Component: Uncategorizedcontrib.postgres
Description: modified (diff)
Summary: (form) RangeFields should handle (None, None) better.form RangeFields should treat (None, None) as Range(None, None) rather than None
Type: UncategorizedBug

I'm not sure -- could you elaborate on the use case? How can you submit a [None, None] value in an HTML form (or are you also advocating transforming ['', ''] to Range(None, None))?

comment:2 by Tim Graham, 7 years ago

Resolution: needsinfo
Status: newclosed

(awaiting clarification)

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