Ticket #3515: 01-form-row-widget-class.diff

File 01-form-row-widget-class.diff, 924 bytes (added by Petr Marhoun <petr.marhoun@…>, 11 years ago)
  • django/newforms/forms.py

    === modified file 'django/newforms/forms.py'
     
    133133            else:
    134134                outer_attrs = bf.field.widget.outer_attrs
    135135                outer_class_list = outer_attrs.pop('class', '').split()
     136                outer_class_list.append(bf.field.widget.__class__.__name__)
    136137                if bf.field.required:
    137138                    outer_class_list.append('required')
    138139                if bf_errors:
    139140                    outer_class_list.append('error')
    140                 if outer_class_list:
    141                     outer_attrs['class'] = ' '.join(outer_class_list)
     141                outer_attrs['class'] = ' '.join(outer_class_list)
    142142                if errors_on_separate_row and bf_errors:
    143143                    output.append(error_row % force_unicode(bf_errors))
    144144                if bf.label:
Back to Top