mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Merge pull request #5084 from Nerlin/fix-render-required-nested-serializer-error
Fixed render error of required nested serializer.
This commit is contained in:
commit
d2d0a06faf
|
@ -112,7 +112,7 @@ class NestedBoundField(BoundField):
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
field = self.fields[key]
|
field = self.fields[key]
|
||||||
value = self.value.get(key) if self.value else None
|
value = self.value.get(key) if self.value else None
|
||||||
error = self.errors.get(key) if self.errors else None
|
error = self.errors.get(key) if isinstance(self.errors, dict) else None
|
||||||
if hasattr(field, 'fields'):
|
if hasattr(field, 'fields'):
|
||||||
return NestedBoundField(field, value, error, prefix=self.name + '.')
|
return NestedBoundField(field, value, error, prefix=self.name + '.')
|
||||||
return BoundField(field, value, error, prefix=self.name + '.')
|
return BoundField(field, value, error, prefix=self.name + '.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user