Index: django/forms/forms.py =================================================================== --- django/forms/forms.py (revision 12027) +++ django/forms/forms.py (working copy) @@ -137,9 +137,9 @@ "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()." top_errors = self.non_field_errors() # Errors that should be displayed above all fields. output, hidden_fields = [], [] - html_class_attr = '' for name, field in self.fields.items(): + html_class_attr = '' bf = BoundField(self, field, name) bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable. if bf.is_hidden: Index: tests/regressiontests/forms/forms.py =================================================================== --- tests/regressiontests/forms/forms.py (revision 12027) +++ tests/regressiontests/forms/forms.py (working copy) @@ -1816,6 +1816,11 @@ # The error_html_class and required_html_class attributes #################### +>>> class Person(Form): +... name = CharField() +... is_cool = NullBooleanField() +... email = EmailField(required=False) + >>> p = Person({}) >>> p.error_css_class = 'error' >>> p.required_css_class = 'required' @@ -1827,6 +1832,7 @@ +
>>> print p.as_table()