Skip to content

Commit ead4485

Browse files
tbartelmesskhornberg
authored andcommitted
use the presense of ‘child_relation’ in kwargs to see if it’s a many relationship
1 parent 7d5908f commit ead4485

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework_json_api/renderers.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,12 @@ def extract_included(fields, resource, resource_instance, included_resources):
285285
serializer_class = included_serializers.get(field_name)
286286
if relation_instance_or_manager is None:
287287
continue
288-
field = serializer_class(relation_instance_or_manager, context=context)
288+
289+
many = field._kwargs.get('child_relation', None) is not None
290+
291+
field = serializer_class(relation_instance_or_manager,
292+
many=many,
293+
context=context)
289294
serializer_data = field.data
290295

291296
if isinstance(field, ListSerializer):

0 commit comments

Comments
 (0)