summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2013-06-19 23:42:23 -0400
committerSimon Charette <charette.s@gmail.com>2013-06-20 10:59:41 -0400
commit04628e2016641bfa657333d6ee1f5b371c17f62c (patch)
tree09267c5cac81eeee1d3eac8e75c1394d0b60cd87 /django/forms
parent6ef199a08e1c452289deda67629b1630d25ccfcf (diff)
Fixed #20630 -- Removed `maxlength` attribute from `NumberInput`.
This attribute is only allowed on inputs of type "text", "search", "url", "tel", "email", or "password". Thanks to yoyoma for the report and @bmispelon for the review.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/fields.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 52bcf9485c..c4bc3fa88c 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -370,14 +370,8 @@ class DecimalField(IntegerField):
def widget_attrs(self, widget):
attrs = super(DecimalField, self).widget_attrs(widget)
- if isinstance(widget, NumberInput):
- if self.max_digits is not None:
- max_length = self.max_digits + 1 # for the sign
- if self.decimal_places is None or self.decimal_places > 0:
- max_length += 1 # for the dot
- attrs['maxlength'] = max_length
- if self.decimal_places:
- attrs['step'] = '0.%s1' % ('0' * (self.decimal_places-1))
+ if isinstance(widget, NumberInput) and self.decimal_places:
+ attrs['step'] = '0.%s1' % ('0' * (self.decimal_places - 1))
return attrs