Pagination classes¶
Async-aware paginators that drive the apaginate_queryset() hook on
async views. See the Pagination guide
for selection criteria and tuning.
BasePagination ¶
Bases: BasePagination
All pagination classes should extend BasePagination. Adds an async apaginate_queryset hook that defaults to running the sync paginate_queryset in a thread.
apaginate_queryset
async
¶
Returns a list of items for a single page of the queryset, or None if pagination is disabled.
PageNumberPagination ¶
Bases: BasePagination, PageNumberPagination
A simple page number based style that supports page numbers as query parameters. Adds an async apaginate_queryset that uses async ORM (acount, async iteration) instead of sync_to_async.
apaginate_queryset
async
¶
Returns a list of items for the requested page, or None if pagination is disabled.
LimitOffsetPagination ¶
Bases: BasePagination, LimitOffsetPagination
A limit/offset based style. Adds an async apaginate_queryset that uses async ORM (acount, async iteration) instead of sync_to_async.
apaginate_queryset
async
¶
Returns a list of items for the current limit/offset window, or None if pagination is disabled.
CursorPagination ¶
Bases: BasePagination, CursorPagination
The cursor pagination implementation is necessarily complex. Inherits DRF's sync paginate_queryset; the async surface defaults to sync_to_async.
FastPageNumberPagination ¶
Bases: BasePagination
Page number pagination that skips the COUNT(*) query. Determines whether a next page exists by checking if the current page is full, and omits the count field from the response.