summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-03-17 10:30:17 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-03-17 10:30:17 +0000
commitcf7a3fa7f06814a7a22198fb9f84f6b9c0f09461 (patch)
tree2e4ac33f483f918df57a03877a1e296d52a7f089 /django/forms
parent536ccd1134d747bc22cf80c42c332e533146a9fe (diff)
Fixed #10512 -- Corrected the handling of extra fields on a ModelForm. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10070 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 595b775f4f..d62a2ce713 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -163,7 +163,7 @@ def fields_for_model(model, fields=None, exclude=None, formfield_callback=lambda
field_list.append((f.name, formfield))
field_dict = SortedDict(field_list)
if fields:
- field_dict = SortedDict([(f, field_dict[f]) for f in fields if (not exclude) or (exclude and f not in exclude)])
+ field_dict = SortedDict([(f, field_dict.get(f)) for f in fields if (not exclude) or (exclude and f not in exclude)])
return field_dict
class ModelFormOptions(object):