From ac49733aff8fe7ccfd24f88da1abc100962ee37a Mon Sep 17 00:00:00 2001 From: GammaSQ Date: Fri, 30 Aug 2019 14:28:58 +0200 Subject: [PATCH] change to get attributes from child_instance instead of general get_attribute --- rest_framework/relations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 3c2132c5b..e4dbfc45e 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -526,7 +526,7 @@ class ManyRelatedField(Field): if hasattr(instance, 'pk') and instance.pk is None: return [] - relationship = get_attribute(instance, self.source_attrs) + relationship = self.child_relation.get_attribute(instance) return relationship.all() if hasattr(relationship, 'all') else relationship def to_representation(self, iterable):