summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2011-11-15 09:36:08 +0000
committerJulien Phalip <jphalip@gmail.com>2011-11-15 09:36:08 +0000
commita6ccc8cc06e6b304e35f7a16f6067e6fa09b63ce (patch)
tree317847d7f4a0b205415653f04ce9ea9e710ea877 /django/forms
parentfae75a32eed227454873f8715bb0d11d6fc3ad39 (diff)
Fixed #15912 -- Ensured that `forms.CharField.widget_attrs()` always returns a dictionary. Thanks to tsabi and rubyruy for the report and to mmcnickle and prestontimmons for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17096 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/fields.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 4cd2911eaa..7f8bac5052 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -197,9 +197,11 @@ class CharField(Field):
return smart_unicode(value)
def widget_attrs(self, widget):
+ attrs = super(CharField, self).widget_attrs(widget)
if self.max_length is not None and isinstance(widget, (TextInput, PasswordInput)):
# The HTML attribute is maxlength, not max_length.
- return {'maxlength': str(self.max_length)}
+ attrs.update({'maxlength': str(self.max_length)})
+ return attrs
class IntegerField(Field):
default_error_messages = {