Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 72d4588

Browse files
Fix for resolving source when accessing sub-attr eg b.c
1 parent 20d98cf commit 72d4588

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎rest_framework_json_api/utils.py‎

Lines changed: 2 additions & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /