Merge pull request #5084 from Nerlin/fix-render-required-nested-serializer-error

Fixed render error of required nested serializer.
This commit is contained in:
Tom Christie 2017-05-02 10:05:25 +01:00 committed by GitHub
commit d2d0a06faf

View File

@ -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 + '.')