标签:
class puppet_edit_confForm(forms.ModelForm): class Meta: model = puppet_edit_config fields = ‘__all__‘ widgets = { ‘contents‘: forms.Textarea(attrs={ ‘style‘: ‘height: 200px;width:500px‘}), } 或者是: class puppet_edit_confForm(forms.ModelForm): class Meta: model = puppet_edit_config fields = ‘__all__‘ def __init__(self, *args, **kwargs): super(puppet_edit_confForm, self).__init__() self.fields[‘contents‘].widget.attrs[‘style‘] = ‘width:500px;height: 200px‘
标签:
原文地址:http://my.oschina.net/u/142602/blog/518580