We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bfa8cba commit f0d6a18Copy full SHA for f0d6a18
ninja_extra/pagination/operations.py
@@ -17,6 +17,8 @@
17
if TYPE_CHECKING: # pragma: no cover
18
from ninja_extra.controllers import ControllerBase
19
20
+import django
21
+
22
23
class PaginatorOperation:
24
def __init__(
@@ -110,10 +112,11 @@ async def as_view(
110
112
request = request_or_controller
111
113
params = dict(kw)
114
params["request"] = request
-
115
+ is_supported_async_orm = django.VERSION >= (4, 2)
116
paginate_queryset = (
117
self.paginator.apaginate_queryset
118
if isinstance(self.paginator, AsyncPaginationBase)
119
+ and is_supported_async_orm
120
else cast(Callable, sync_to_async(self.paginator.paginate_queryset))
121
)
122
return await paginate_queryset(items, **params)
0 commit comments