Opened 4 years ago

Last modified 3 years ago

#32559 closed New feature

Add attribute 'step' to FloatField. — at Version 6

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 Mariusz Felisiak)

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 (6)

comment:1 by Markus Holtermann, 4 years ago

Triage Stage: UnreviewedAccepted

Thank you. Sounds like a perfectly valid use case.

comment:3 by Kapil Bansal, 4 years ago

Owner: changed from nobody to Kapil Bansal
Status: newassigned

comment:4 by Kapil Bansal, 4 years ago

Description: modified (diff)
Has patch: set
Last edited 4 years ago by Mariusz Felisiak (previous) (diff)

comment:5 by Mariusz Felisiak, 4 years ago

Summary: Add attribute 'step' to FloatField and DecimalFieldAdd attribute 'step' to FloatField.

comment:6 by Mariusz Felisiak, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top