Open qodot opened 2 months ago
When applying the paginate decorator to an async view that returns a Django queryset, a SynchronousOnlyOperation error occurs. (cause of https://github.com/vitalik/django-ninja/blob/457c066c82eb30203aab1e0d3c6b7c46befd2996/ninja/pagination.py#L206-L208)
paginate
SynchronousOnlyOperation
To resolve this, I've added _inject_async_pagination within the paginate and RouterPaginated and differentiated the behavior based on the view type.
_inject_async_pagination
RouterPaginated
When applying the
paginate
decorator to an async view that returns a Django queryset, aSynchronousOnlyOperation
error occurs. (cause of https://github.com/vitalik/django-ninja/blob/457c066c82eb30203aab1e0d3c6b7c46befd2996/ninja/pagination.py#L206-L208)To resolve this, I've added
_inject_async_pagination
within thepaginate
andRouterPaginated
and differentiated the behavior based on the view type.