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.
--
Ticket URL: <https://code.djangoproject.com/ticket/28310>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* component: Uncategorized => contrib.postgres
* type: Uncategorized => Bug
Old 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.
New 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,
[https://github.com/django/django/blob/a6b5321ce997b899e540bb427cca98cb2b93a106/django/forms/fields.py#L992
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.
--
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)`)?
--
Ticket URL: <https://code.djangoproject.com/ticket/28310#comment:1>
* status: new => closed
* resolution: => needsinfo
Comment:
(awaiting clarification)
--
Ticket URL: <https://code.djangoproject.com/ticket/28310#comment:2>