Serializer's to_representation does not check a proper manager base class

18 views
Skip to first unread message

Kamil Kamil

unread,
Aug 20, 2021, 12:05:17 PM8/20/21
to Django users
I am wondering why in the serializer's to_representation method, in this line:

iterable = data.all() if isinstance(data, models.Manager) else data

Manager base class is checked, but not BaseManager?
I am asking because I have something like this:
class MyQuerySet(QuerySet):
   ....
class MyManager(BaseManager.from_queryset(MyQuerySet):
   ...
but then I can't serialize the list of elements because MyManager is not an instance of Manager. I could do MyManager(Manager.from_queryset(MyQuerySet) but is it a good idea? - I rather think this should be changed in django code
Reply all
Reply to author
Forward
0 new messages