From 61becb6bc634720ca7669c64079886f6b106738a Mon Sep 17 00:00:00 2001 From: 954 <510485871@qq.com> Date: Tue, 25 Oct 2022 07:58:26 +0800 Subject: [PATCH] Change to only BaseManager --- rest_framework/serializers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 8bb28e3f8b..9dfb90f769 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -681,9 +681,7 @@ def to_representation(self, data): """ # Dealing with nested relationships, data can be a Manager, # so, first get a queryset from the Manager if needed - iterable = data.all() if isinstance(data, ( - models.manager.Manager, models.manager.BaseManager - )) else data + iterable = data.all() if isinstance(data, models.manager.BaseManager) else data return [ self.child.to_representation(item) for item in iterable