как это?
class ClassyRadioSelect(forms.RadioSelect):
def __init__(self, *args, **kwargs):
#yes, i've to look up how to process args and kwargs properly
attrs = kwargs.get('attrs', {})
attrs['class'] = ' '.join((attrs.get('class',''), 'radio'))
kwargs['attrs'] = attrs
super(ClassyRadioSelect, self).__init__(*args, **kwargs)
class ClassyChoiceField(forms.ChoiceField):
def __init__(self, choices=(), required=True, widget=None, label=None,
initial=None, help_text=None, *args, **kwargs):
if not widget:
widget = ClassyRadioSelect()
super(ClassyChoiceField, self).__init__(choices, required, widget, label
, initial, help_text, *args,
**kwargs)
class MyForm(forms.Form):
classy_field1 = ClassyChoiceField()
classy_field2 = ClassyChoiceField()