Add attribute 'step' to FloatField.
— at Version 8
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
Change History
(8)
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to Kapil Bansal
|
Status: |
new → assigned
|
Description: |
modified (diff)
|
Has patch: |
set
|
Summary: |
Add attribute 'step' to FloatField and DecimalField → Add attribute 'step' to FloatField.
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Needs tests: |
unset
|
Thank you. Sounds like a perfectly valid use case.