Skip to content

Commit a953a03

Browse files
cosmosgeniusmblayman
authored andcommitted
Fix for resolving source when accessing sub-attr eg b.c (#375)
1 parent 20d98cf commit a953a03

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
@@ -3,6 +3,7 @@
33
"""
44
import copy
55
import inspect
6+
import operator
67
import warnings
78
from collections import OrderedDict
89

@@ -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)