Opened 8 years ago

Closed 8 years ago

#12551 closed (duplicate)

html_class_attr is not being cleared in loop within forms._html_output

Reported by: Skidd Owned by: nobody
Component: Forms Version: 1.2-alpha
Severity: Keywords: error_css_class form field
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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
        html_class_attr = ''


    for name, field in self.fields.items():
        html_class_attr = ''


Change History (1)

comment:1 Changed 8 years ago by Jannis Leidel

Resolution: duplicate
Status: newclosed

Duplicate of #12466

Note: See TracTickets for help on using tickets.
Back to Top