Skip to content

Commit

Permalink
Clean up the form's code a little bit, to make it more consistantly g…
Browse files Browse the repository at this point in the history
…o through one code path. Patch from Travis Swicegood.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17381 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Jan 19, 2012
1 parent e8e4293 commit 477f4d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions django/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def __unicode__(self):
return self.as_table()

def __iter__(self):
for name, field in self.fields.items():
yield BoundField(self, field, name)
for name in self.fields:
yield self[name]

def __getitem__(self, name):
"Returns a BoundField with the given name."
Expand Down Expand Up @@ -145,7 +145,7 @@ def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_

for name, field in self.fields.items():
html_class_attr = ''
bf = BoundField(self, field, name)
bf = self[name]
bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable.
if bf.is_hidden:
if bf_errors:
Expand Down

0 comments on commit 477f4d8

Please sign in to comment.