Skip to content

Commit f3e97ef

Browse files
author
Tim Csitkovics
committed
fixup! Do not lazy load forward relations
1 parent 3710bb5 commit f3e97ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework_json_api/serializers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ def to_representation(self, instance):
184184
try:
185185
context = getattr(self, '_context', {})
186186
request = getattr(context.get('request', None), '_request', None)
187-
is_included = request is not None and field.source in getattr(request, 'GET', None)
187+
get_dict = getattr(request, 'GET', None) if request is not None else {}
188+
is_included = 'include' in get_dict and field.source in get_dict['include'].split(',')
188189
if not is_included \
189190
and isinstance(field, ModelSerializer) \
190191
and hasattr(instance, field.source + "_id"):

0 commit comments

Comments
 (0)