Skip to content

Fix for resolving source when accessing sub-attr eg b.c #375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rest_framework_json_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import copy
import inspect
import operator
import warnings
from collections import OrderedDict

Expand Down Expand Up @@ -339,7 +340,7 @@ def get_included_serializers(serializer):

def get_relation_instance(resource_instance, source, serializer):
try:
relation_instance = getattr(resource_instance, source)
relation_instance = operator.attrgetter(source)(resource_instance)
except AttributeError:
# if the field is not defined on the model then we check the serializer
# and if no value is there we skip over the field completely
Expand Down