Opened 5 years ago
Last modified 3 years ago
#32559 closed New feature
Add attribute 'step' to FloatField and DecimalField — at Version 4
| Reported by: | Jacob Rief | Owned by: | Kapil Bansal |
|---|---|---|---|
| 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 (last modified by )
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.
Change History (4)
comment:1 by , 5 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:4 by , 5 years ago
| Description: | modified (diff) |
|---|---|
| Has patch: | set |
Thank you. Sounds like a perfectly valid use case.