summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2012-01-19 22:05:47 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2012-01-19 22:05:47 +0000
commit477f4d80616392bbd3352cad50faedb9c1494b33 (patch)
tree628d20b6761af515011382815de08e86c478d140
parente8e4293a485fc51d7b699c24e5d1340fdee25d03 (diff)
Clean up the form's code a little bit, to make it more consistantly go through one code path. Patch from Travis Swicegood.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17381 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/forms/forms.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py
index d3f2046779..198d21d6e7 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -98,8 +98,8 @@ class BaseForm(StrAndUnicode):
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."
@@ -145,7 +145,7 @@ class BaseForm(StrAndUnicode):
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: