[Django] #32559: Add attribute 'step' to FloatField and DecimalField

78 views
Skip to first unread message

Django

unread,
Mar 17, 2021, 3:50:33 AM3/17/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField and DecimalField
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: nobody
Rief |
Type: New | Status: new
feature |
Component: Forms | Version: dev
Severity: Normal | Keywords: FloatField,
Triage Stage: | NumberInput, step
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If someone wants to use the `step` attribute as provided by the HTML field
`<input type="number" ...>` , she/he has to specify that using for
instance
`FloatField(widget=NumberInput(attrs={'step': 0.5}))`.

Since the HTML standard offers a `step` attribute on input fields of
`type="number"`,
this feature shall be reflected by Django's `FloatField` and optionally
`DecimalField`,
rather than having to parametrize the widget.

Min- and max-values are already supported by the `FloatField`, so the
step-value
would make sense here as well. It furthermore would require to revalidate
the
step-value by Django's Form validation, rather than by HTML alone.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 17, 2021, 4:10:46 AM3/17/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField and DecimalField
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Markus Holtermann):

* stage: Unreviewed => Accepted


Comment:

Thank you. Sounds like a perfectly valid use case.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:1>

Django

unread,
Mar 17, 2021, 12:40:02 PM3/17/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField and DecimalField
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

[https://groups.google.com/g/django-
developers/c/oVWKJUXTb1o/m/b1Oo0zqeAwAJ django-developers discussion]

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:2>

Django

unread,
Mar 20, 2021, 7:19:23 AM3/20/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField and DecimalField
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner:
| devkapilbansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by devkapilbansal):

* owner: nobody => devkapilbansal
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:3>

Django

unread,
Mar 20, 2021, 1:31:37 PM3/20/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField and DecimalField
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal

Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kapil Bansal):

* has_patch: 0 => 1


Old description:

> If someone wants to use the `step` attribute as provided by the HTML
> field
> `<input type="number" ...>` , she/he has to specify that using for
> instance
> `FloatField(widget=NumberInput(attrs={'step': 0.5}))`.
>
> Since the HTML standard offers a `step` attribute on input fields of
> `type="number"`,
> this feature shall be reflected by Django's `FloatField` and optionally
> `DecimalField`,
> rather than having to parametrize the widget.
>
> Min- and max-values are already supported by the `FloatField`, so the
> step-value
> would make sense here as well. It furthermore would require to revalidate
> the
> step-value by Django's Form validation, rather than by HTML alone.

New description:

If someone wants to use the `step` attribute as provided by the HTML field
`<input type="number" ...>` , she/he has to specify that using for
instance
`FloatField(widget=NumberInput(attrs={'step': 0.5}))`.

Since the HTML standard offers a `step` attribute on input fields of
`type="number"`,
this feature shall be reflected by Django's `FloatField` and optionally
`DecimalField`,
rather than having to parametrize the widget.

Min- and max-values are already supported by the `FloatField`, so the
step-value
would make sense here as well. It furthermore would require to revalidate
the
step-value by Django's Form validation, rather than by HTML alone.

Patch: https://github.com/django/django/pull/14162

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:4>

Django

unread,
Mar 20, 2021, 1:47:27 PM3/20/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.

-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:5>

Django

unread,
Mar 20, 2021, 1:49:47 PM3/20/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Mariusz Felisiak:

Old description:

> If someone wants to use the `step` attribute as provided by the HTML
> field
> `<input type="number" ...>` , she/he has to specify that using for
> instance
> `FloatField(widget=NumberInput(attrs={'step': 0.5}))`.
>
> Since the HTML standard offers a `step` attribute on input fields of
> `type="number"`,
> this feature shall be reflected by Django's `FloatField` and optionally
> `DecimalField`,
> rather than having to parametrize the widget.
>
> Min- and max-values are already supported by the `FloatField`, so the
> step-value
> would make sense here as well. It furthermore would require to revalidate
> the
> step-value by Django's Form validation, rather than by HTML alone.
>

> Patch: https://github.com/django/django/pull/14162

New description:

If someone wants to use the `step` attribute as provided by the HTML field
`<input type="number" ...>` , she/he has to specify that using for
instance
`FloatField(widget=NumberInput(attrs={'step': 0.5}))`.

Since the HTML standard offers a `step` attribute on input fields of
`type="number"`,
this feature shall be reflected by Django's `FloatField` and optionally
`DecimalField`,
rather than having to parametrize the widget.

Min- and max-values are already supported by the `FloatField`, so the
step-value
would make sense here as well. It furthermore would require to revalidate
the
step-value by Django's Form validation, rather than by HTML alone.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:6>

Django

unread,
Mar 22, 2021, 3:20:08 AM3/22/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:7>

Django

unread,
Mar 22, 2021, 4:20:51 PM3/22/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kapil Bansal):

* needs_tests: 1 => 0


Old description:

> If someone wants to use the `step` attribute as provided by the HTML
> field
> `<input type="number" ...>` , she/he has to specify that using for
> instance
> `FloatField(widget=NumberInput(attrs={'step': 0.5}))`.
>
> Since the HTML standard offers a `step` attribute on input fields of
> `type="number"`,
> this feature shall be reflected by Django's `FloatField` and optionally
> `DecimalField`,
> rather than having to parametrize the widget.
>
> Min- and max-values are already supported by the `FloatField`, so the
> step-value
> would make sense here as well. It furthermore would require to revalidate
> the
> step-value by Django's Form validation, rather than by HTML alone.

New description:

If someone wants to use the `step` attribute as provided by the HTML field
`<input type="number" ...>` , she/he has to specify that using for
instance
`FloatField(widget=NumberInput(attrs={'step': 0.5}))`.

Since the HTML standard offers a `step` attribute on input fields of
`type="number"`,
this feature shall be reflected by Django's `FloatField` and optionally
`DecimalField`,
rather than having to parametrize the widget.

Min- and max-values are already supported by the `FloatField`, so the
step-value
would make sense here as well. It furthermore would require to revalidate
the
step-value by Django's Form validation, rather than by HTML alone.

Patch: https://github.com/django/django/pull/14162

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:8>

Django

unread,
May 22, 2021, 3:54:05 AM5/22/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam Johnson):

On [https://forum.djangoproject.com/t/fixed-32559-add-attribute-step-to-
floatfield/7148 the forum], Kapil wrote:

> Hi,
> I was working on ticket 32559 to add step in FloatField but how to write
validation check for this.
> Due to python floating point issues, I am not able to validate whether
field value is of given step_size or not

The loss of precision in floating points is a real issue. The normal way
to validate would be to use the modulo operator to check there is no
remainder after dividing by the step, but this isn't possible in floating
points with common decimal steps like 0.1:

{{{
>>> step = 0.1
>>> 1 % step == 0
False
>>> 1 % step
0.09999999999999995
}}}

This problem cannot be solved for `FloatField` - I suggest we move the
ticket to modify `DecimalField`, as `Decimal` objects do not have the same
problem:

{{{
>>> from decimal import Decimal
>>> step = Decimal('0.1')
>>> Decimal(1) % step == 0
True
>>> Decimal(1) % step
Decimal('0.0')
}}}

We'd want to enforce that `step` is given as a `Decimal`.

The `float` problem can also occur when constructing a `Decimal` from a
`float`:

{{{
>>> Decimal(0.1)
Decimal('0.1000000000000000055511151231257827021181583404541015625')
}}}

Perhaps we should have a check that the given step does not have more than
10 digits after the decimal point?

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:9>

Django

unread,
May 22, 2021, 8:13:58 AM5/22/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Kapil Bansal):

Hi,
I got a reply on mailing list to use math.isclose function. Pull Request
is already opened to be reviewed

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:10>

Django

unread,
May 24, 2021, 4:42:24 PM5/24/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Jacob Rief:

Old description:

> If someone wants to use the `step` attribute as provided by the HTML
> field
> `<input type="number" ...>` , she/he has to specify that using for
> instance
> `FloatField(widget=NumberInput(attrs={'step': 0.5}))`.
>
> Since the HTML standard offers a `step` attribute on input fields of
> `type="number"`,
> this feature shall be reflected by Django's `FloatField` and optionally
> `DecimalField`,
> rather than having to parametrize the widget.
>
> Min- and max-values are already supported by the `FloatField`, so the
> step-value
> would make sense here as well. It furthermore would require to revalidate
> the
> step-value by Django's Form validation, rather than by HTML alone.
>

> Patch: https://github.com/django/django/pull/14162

New description:

I reviewed that pull request and after some testing I came to the
conclusion, that `math.isclose` with a tolerance of `1e-9` is the best
solution to fix the floating point rounding errors. All other approaches
did not work properly or were far too complicated.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:11>

Django

unread,
May 24, 2021, 4:45:46 PM5/24/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Kapil
| Bansal
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

> I reviewed that pull request and after some testing I came to the
> conclusion, that `math.isclose` with a tolerance of `1e-9` is the best
> solution to fix the floating point rounding errors. All other approaches
> did not work properly or were far too complicated.

New description:

If someone wants to use the `step` attribute as provided by the HTML field
`<input type="number" ...>` , she/he has to specify that using for
instance
`FloatField(widget=NumberInput(attrs={'step': 0.5}))`.

Since the HTML standard offers a `step` attribute on input fields of
`type="number"`,
this feature shall be reflected by Django's `FloatField` and optionally
`DecimalField`,
rather than having to parametrize the widget.

Min- and max-values are already supported by the `FloatField`, so the
step-value
would make sense here as well. It furthermore would require to revalidate
the
step-value by Django's Form validation, rather than by HTML alone.

Patch: https://github.com/django/django/pull/14162

--

Comment (by Jacob Rief):

I reviewed that pull request and after some testing I came to the
conclusion, that `math.isclose` with a tolerance of `1e-9` is the best
solution to fix the floating point rounding errors. All other approaches
did not work properly or were far too complicated.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:12>

Django

unread,
Jun 17, 2021, 10:08:50 AM6/17/21
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief

Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Rief):

* owner: Kapil Bansal => Jacob Rief


Comment:

Reclaiming ticket because of missing progress.

A new pull request is here: https://github.com/django/django/pull/14532
This adds the missing documentation and release note for this feature.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:13>

Django

unread,
Jan 26, 2022, 6:32:50 AM1/26/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1


* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:14>

Django

unread,
Jan 26, 2022, 6:35:54 AM1/26/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Current PR removes the default `step="any"` which is a problem.

Comment from PR:

> This introduces a regression from
7ec2a21be15af5b2c7513482c3bcfdd1e12782ed.
>
> We need a selenium test to cover it, but if I create an `<input
type="number" />` without the `step` specified at all, I can't enter a
non-integer value, such as `0.5` without triggering the browser validation
(''Enter a valid value'').
>
> This ties in with [https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/input/number#step MDN docs for step]:
>
>> The default stepping value for number inputs is 1, allowing only
integers to be entered…

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:15>

Django

unread,
Jan 29, 2022, 5:13:47 PM1/29/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Jacob Rief):

I re-added the attribute `step="any"` to the `FloatField` . However, I
don't know where to add a Selenium test for check this.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:16>

Django

unread,
Feb 1, 2022, 5:50:00 AM2/1/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0


* needs_tests: 1 => 0


Comment:

Thanks Jacob! I'll take another look.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:17>

Django

unread,
Feb 3, 2022, 9:06:59 AM2/3/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"4b8e9492d9003ca357a4402f831112dd72efd2f8" 4b8e9492]:
{{{
#!CommitTicketReference repository=""
revision="4b8e9492d9003ca357a4402f831112dd72efd2f8"
Refs #32559 -- Added selenium test for FloatField client-side validation.

step="any" is required for non-integer values. See:
https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/input/number#step

Covers behaviour added in 7ec2a21be15af5b2c7513482c3bcfdd1e12782ed.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:18>

Django

unread,
Apr 7, 2022, 10:20:18 AM4/7/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:19>

Django

unread,
Apr 15, 2022, 8:51:04 AM4/15/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Jacob Rief):

> step="any" is required for non-integer values.

shall I add this? According to the Mozilla developer docs, the `step` is
not mandatory and default to `1` for number input fields, so I'm unsure
what to change here.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:20>

Django

unread,
Apr 19, 2022, 2:22:03 AM4/19/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Hey Jacob. See
[https://github.com/django/django/pull/14532#pullrequestreview-935148664
my comment on the PR for outstanding issues]. Specifically, the docs need
`versionchanged`/`versionadded` annotations, and (more) the new validator
needs tests, matching those for the other validator classes.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:21>

Django

unread,
Apr 19, 2022, 6:19:49 PM4/19/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev

Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Accepted
NumberInput, step |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Jacob Rief):

* Added `versionadded` annotations to the docs.
* Added tests for new validator `StepValueValidator`.
* Fixed all annotations from black and flake8.

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:22>

Django

unread,
May 12, 2022, 4:09:54 AM5/12/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: FloatField, | Triage Stage: Ready for
NumberInput, step | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:23>

Django

unread,
May 12, 2022, 8:17:46 AM5/12/22
to django-...@googlegroups.com
#32559: Add attribute 'step' to FloatField.
-------------------------------------+-------------------------------------
Reporter: Jacob Rief | Owner: Jacob
| Rief
Type: New feature | Status: closed
Component: Forms | Version: dev
Severity: Normal | Resolution: fixed

Keywords: FloatField, | Triage Stage: Ready for
NumberInput, step | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson <carlton@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3a82b5f655446f0ca89e3b6a92b100aa458f348f" 3a82b5f6]:
{{{
#!CommitTicketReference repository=""
revision="3a82b5f655446f0ca89e3b6a92b100aa458f348f"
Fixed #32559 -- Added 'step_size’ to numeric form fields.

Co-authored-by: Jacob Rief <jacob...@uibk.ac.at>
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32559#comment:24>

Reply all
Reply to author
Forward
0 new messages