Skip to content

Commit 42b3f57

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

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
@@ -185,7 +185,8 @@ def to_representation(self, instance):
185185
context = getattr(self, '_context', {})
186186
request = getattr(context.get('request', None), '_request', None)
187187
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(',')
188+
includes = get_dict['include'].split(',') if 'include' in get_dict else []
189+
is_included = field.source in includes
189190
if not is_included \
190191
and isinstance(field, ModelSerializer) \
191192
and hasattr(instance, field.source + "_id"):

0 commit comments

Comments
 (0)