Skip to content

Commit 57d837c

Browse files
committed
return None values as None in ListSerializer.to_representation
1 parent 9864c47 commit 57d837c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def to_representation(self, data):
711711
iterable = data.all() if isinstance(data, models.manager.BaseManager) else data
712712

713713
return [
714-
self.child.to_representation(item) for item in iterable
714+
self.child.to_representation(item) if item is not None else None for item in iterable
715715
]
716716

717717
def validate(self, attrs):

0 commit comments

Comments
 (0)