Opened 4 years ago
Last modified 3 years ago
#32559 closed New feature
Add attribute 'step' to FloatField and DecimalField — at Initial Version
Reported by: | Jacob Rief | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | FloatField, NumberInput, step |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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.