We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 779cd9b commit 19867dfCopy full SHA for 19867df
rest_framework_json_api/utils.py
@@ -4,6 +4,7 @@
4
import copy
5
import inspect
6
import warnings
7
+import operator
8
from collections import OrderedDict
9
10
import django
@@ -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