Fixed #8169 -- Honor attrs from subclasses of the new admin widgets introduced in [8240]. Thanks Alex Gaynor for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-08 21:27:03 +00:00
parent 19bbc74e46
commit 1c9ca83db2
1 changed files with 20 additions and 8 deletions

View File

@ -210,17 +210,29 @@ class RelatedFieldWidgetWrapper(forms.Widget):
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)