Opened 11 years ago

Closed 11 years ago

#21752 closed Bug (fixed)

forms.NumberInput - "step" always forced to "any", cannot modify

Reported by: orcein@… Owned by: Claude Paroz
Component: Forms Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm trying to customize my form widgets, and I have the following code:

rand_range = forms.NumberInput(attrs={'step': 0.01, 'max': 1.0, 'min': 0.0})

However when the field is rendered in HTML, the step is always set to "any". I have also tried putting the number in quotes to no perceivable result. "min" and "max" values are working correctly.

Attachments (1)

21752-1.diff (2.1 KB ) - added by Claude Paroz 11 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Tim Graham, 11 years ago

Could you write a test for Django's test suite that demonstrates the issue? There are some tests for step in forms_tests/tests/test_fields.py.

comment:2 by Claude Paroz, 11 years ago

Owner: changed from nobody to Claude Paroz
Status: newassigned
Triage Stage: UnreviewedAccepted

I can confirm. I'll investigate this issue.

by Claude Paroz, 11 years ago

Attachment: 21752-1.diff added

comment:3 by Claude Paroz, 11 years ago

Has patch: set

Here's the most straightforward way to fix this issue.

comment:4 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 18374c1d8c37dd251dae72470b6c532bddf140eb:

Fixed #21752 -- Prevented custom widget step attribute to be overwritten

Thanks orcein at gmail.com for the report.

Note: See TracTickets for help on using tickets.
Back to Top