mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Checks and repr on BoundField
This commit is contained in:
parent
5d247a65c8
commit
f83ed19d22
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user