Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #8169 -- Honor attrs from subclasses of the new admin widgets i…

…ntroduced in [8240]. Thanks Alex Gaynor for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1c9ca83db2a73e8eb920fb50a2f1ee9a8228bcbf 1 parent 19bbc74
@brosner brosner authored
Showing with 20 additions and 8 deletions.
  1. +20 −8 django/contrib/admin/widgets.py
View
28 django/contrib/admin/widgets.py
@@ -210,17 +210,29 @@ def id_for_label(self, id_):
return self.widget.id_for_label(id_)
class AdminTextareaWidget(forms.Textarea):
- def __init__(self, attrs={}):
- super(AdminTextareaWidget, self).__init__(attrs={'class': 'vLargeTextField'})
+ def __init__(self, attrs=None):
+ final_attrs = {'class': 'vLargeTextField'}
+ if attrs is not None:
+ final_attrs.update(attrs)
+ super(AdminTextareaWidget, self).__init__(attrs=final_attrs})
class AdminTextInputWidget(forms.TextInput):
- def __init__(self, attrs={}):
- super(AdminTextInputWidget, self).__init__(attrs={'class': 'vTextField'})
+ def __init__(self, attrs=None):
+ final_attrs = {'class': 'vTextField'}
+ if attrs is not None:
+ final_attrs.update(attrs)
+ super(AdminTextInputWidget, self).__init__(attrs=final_attrs)
class AdminURLFieldWidget(forms.TextInput):
- def __init__(self, attrs={}):
- super(AdminURLFieldWidget, self).__init__(attrs={'class': 'vURLField'})
+ def __init__(self, attrs=None):
+ final_attrs = {'class': 'vURLField'}
+ if attrs is not None:
+ final_attrs.update(attrs)
+ super(AdminURLFieldWidget, self).__init__(attrs=final_attrs)
class AdminIntegerFieldWidget(forms.TextInput):
- def __init__(self, attrs={}):
- super(AdminIntegerFieldWidget, self).__init__(attrs={'class': 'vIntegerField'})
+ def __init__(self, attrs=None):
+ final_attrs = {'class': 'vIntegerField'}
+ if attrs is not None:
+ final_attrs.update(attrs)
+ super(AdminIntegerFieldWidget, self).__init__(attrs=final_attrs)
Please sign in to comment.
Something went wrong with that request. Please try again.