Checks and repr on BoundField

This commit is contained in:
Tom Christie 2014-10-09 16:29:34 +01:00
parent 5d247a65c8
commit f83ed19d22

View File

@ -180,6 +180,7 @@ class BoundField(object):
yield self[field.field_name]
def __getitem__(self, key):
assert hasattr(self, 'fields'), '"%s" is not a nested field. Cannot perform indexing.' % self.name
field = self.fields[key]
value = self.value.get(key) if self.value else None
error = self.errors.get(key) if self.errors else None
@ -189,6 +190,9 @@ class BoundField(object):
def _proxy_class(self):
return self._field.__class__
def __repr__(self):
return '<%s value=%s errors=%s>' % (self.__class__.__name__, self.value, self.errors)
class BindingDict(object):
"""