1 parent 20d98cf commit a953a03Copy full SHA for a953a03
rest_framework_json_api/utils.py
@@ -3,6 +3,7 @@
3
"""
4
import copy
5
import inspect
6
+import operator
7
import warnings
8
from collections import OrderedDict
9
@@ -339,7 +340,7 @@ def get_included_serializers(serializer):
339
340
341
def get_relation_instance(resource_instance, source, serializer):
342
try:
- relation_instance = getattr(resource_instance, source)
343
+ relation_instance = operator.attrgetter(source)(resource_instance)
344
except AttributeError:
345
# if the field is not defined on the model then we check the serializer
346
# and if no value is there we skip over the field completely
0 commit comments