Skip to content

Commit 484adc2

Browse files
committed
Fix resource_name support for ResourceRelatedField
1 parent c869f34 commit 484adc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework_json_api/relations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def to_representation(self, value):
145145
# check to see if this resource has a different resource_name when
146146
# included and use that name
147147
resource_type = None
148-
root = getattr(self.parent, 'parent', self.parent)
148+
root = getattr(self.parent, 'parent', self.parent) or self.parent
149149
field_name = self.field_name if self.field_name else self.parent.field_name
150150
if getattr(root, 'included_serializers', None) is not None:
151151
includes = get_included_serializers(root)

0 commit comments

Comments
 (0)