change to get attributes from child_instance instead of general get_attribute

This commit is contained in:
GammaSQ 2019-08-30 14:28:58 +02:00
parent ec1b14174f
commit ac49733aff

View File

@ -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):