Commit 768ae26a by KhasanovBI Committed by Tom Christie

Fix None values representation in childs of ListField, DictField. (#4118)

parent daccc2b8
......@@ -1480,7 +1480,7 @@ class ListField(Field):
"""
List of object instances -> List of dicts of primitive datatypes.
"""
return [self.child.to_representation(item) for item in data]
return [self.child.to_representation(item) if item is not None else None for item in data]
class DictField(Field):
......@@ -1527,7 +1527,7 @@ class DictField(Field):
List of object instances -> List of dicts of primitive datatypes.
"""
return {
six.text_type(key): self.child.to_representation(val)
six.text_type(key): self.child.to_representation(val) if val is not None else None
for key, val in value.items()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment