Open Amr-elwetaidy opened 1 week ago
I think .all there used to foce method that does not exist in a list
I think .all there used to foce method that does not exist in a
list
I missed that one, but still why not use if not isinstance(queryset, list): ...
Anyway, The important one is the async, I had to override the class to get it working.
Async Paginator
The evaluate AsyncGenerator causes:
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async
This part of the code is the reason:
In fact, it's unnecessary at all as django already handles the queryset and evaluates it as an AsyncGenerator once you call it with
async for
Similarly with the
count()
andacount()
methods, you can directly call them on the queryset and no need to callall()
first.