Ticket #15489: patch

File patch, 985 bytes (added by anonymous, 13 years ago)
  • django/forms/widgets.py

    diff --git a/django/forms/widgets.py b/django/forms/widgets.py
    index dd5868f..891fe34 100644
    a b class CheckboxInput(Widget):  
    482482        if value not in ('', True, False, None):
    483483            # Only add the 'value' attribute if a value is non-empty.
    484484            final_attrs['value'] = force_unicode(value)
     485        final_attrs['class'] = final_attrs.get('class', '') + ' checkbox'
    485486        return mark_safe(u'<input%s />' % flatatt(final_attrs))
    486487
    487488    def value_from_datadict(self, data, files, name):
    class RadioInput(StrAndUnicode):  
    630631        final_attrs = dict(self.attrs, type='radio', name=self.name, value=self.choice_value)
    631632        if self.is_checked():
    632633            final_attrs['checked'] = 'checked'
     634        final_attrs['class'] = final_attrs.get('class', '') + ' radio'
    633635        return mark_safe(u'<input%s />' % flatatt(final_attrs))
    634636
    635637class RadioFieldRenderer(StrAndUnicode):
Back to Top