Skip to content

Commit 19867df

Browse files
committed
Fix for resolving source when accessing sub-attr eg b.c
1 parent 779cd9b commit 19867df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework_json_api/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import copy
55
import inspect
66
import warnings
7+
import operator
78
from collections import OrderedDict
89

910
import django
@@ -339,7 +340,7 @@ def get_included_serializers(serializer):
339340

340341
def get_relation_instance(resource_instance, source, serializer):
341342
try:
342-
relation_instance = getattr(resource_instance, source)
343+
relation_instance = operator.attrgetter(source)(resource_instance)
343344
except AttributeError:
344345
# if the field is not defined on the model then we check the serializer
345346
# and if no value is there we skip over the field completely

0 commit comments

Comments
 (0)