Changes between Initial Version and Version 1 of Ticket #28310


Ignore:
Timestamp:
Jun 15, 2017, 8:17:56 AM (7 years ago)
Author:
Tim Graham
Comment:

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))?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28310

    • Property Component Uncategorizedcontrib.postgres
    • Property Summary (form) RangeFields should handle (None, None) better.form RangeFields should treat (None, None) as Range(None, None) rather than None
    • Property Type UncategorizedBug
  • Ticket #28310 – Description

    initial v1  
    1 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.
     1When you clean a `RangeField` and pass it in `('', '')`, or `(None, None)`, it falls through to the `MultiValueField` handling, which, when all values are empty, [https://github.com/django/django/blob/a6b5321ce997b899e540bb427cca98cb2b93a106/django/forms/fields.py#L992 treats the cleaned value as empty].
    22
    3 https://github.com/django/django/blob/master/django/forms/fields.py#L992
    4 
    5 Thus:
    6 
    7 
    8 {{{
    9 FloatRangeField().clean([None, None])
    10 }}}
    11 
    12 returns `None`, when it really should return FloatRange(None, None).
     3Thus, `FloatRangeField().clean([None, None])` returns `None`, when it really should return `FloatRange(None, None)`.
    134
    145There is a very large difference between these.
Back to Top