1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.7.x] Fixed #22570 -- Made Form.__getitem__ KeyError more descriptive.

Backport of df60db0e78 from master
This commit is contained in:
Ben Davis
2014-05-03 12:02:07 -05:00
committed by Tim Graham
parent 2dd52d0433
commit 549b658241
2 changed files with 5 additions and 4 deletions

View File

@@ -142,7 +142,8 @@ class BaseForm(object):
try:
field = self.fields[name]
except KeyError:
raise KeyError('Key %r not found in Form' % name)
raise KeyError(
"Key %r not found in '%s'" % (name, self.__class__.__name__))
return BoundField(self, field, name)
@property