html_class_attr is not being cleared in loop within forms._html_output
|Reported by:||Skidd||Owned by:||nobody|
|Severity:||Keywords:||error_css_class form field|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The _html_output() method within django.forms.BaseForm
has a for loop that creates a TR for each field.
The html_class_attr field is not being cleared while iterating through the loop.
As soon as one field has this value set, all following fields get it too.
I found this while using a ModelForm that was forcing all fields to required.
if css_classes: html_class_attr = ' class="%s"' % css_classes else: html_class_attr = ''
for name, field in self.fields.items(): html_class_attr = ''