Skip to content

Commit 3710bb5

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rest_framework_json_api/serializers.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ def to_representation(self, instance):
185185
context = getattr(self, '_context', {})
186186
request = getattr(context.get('request', None), '_request', None)
187187
is_included = request is not None and field.source in getattr(request, 'GET', None)
188-
if not is_included and isinstance(field, ModelSerializer) and hasattr(instance, field.source + "_id"):
188+
if not is_included \
189+
and isinstance(field, ModelSerializer) \
190+
and hasattr(instance, field.source + "_id"):
189191
attribute = getattr(instance, field.source + "_id")
190192
if attribute is None:
191193
ret[field.field_name] = None

0 commit comments

Comments
 (0)