Skip to content

Pagination

rn_forge.django.drf.pagination

AIP-158 cursor pagination and legacy page-number pagination for DRF.

CursorPagination

Bases: CursorPagination

Keyset pagination emitting the AIP-158 envelope over the shared cursor codec.

Rows are ordered by every orderBy term and then the primary key, so a field need not be unique or non-null. Without orderBy the view's default ordering supplies the terms. Pagination is forward-only. Invalid tokens raise :class:rn_forge.web.InvalidCursor.

get_next_page_token()

Return the token for the page after this one, or None on the last.

LegacyPageNumberPagination

Bases: PageNumberPagination

Page-number pagination with DRF's standard envelope and a size cap.

OrderByFilter

Bases: OrderingFilter

AIP-132 orderBy (displayName desc) over the view's ordering_fields.

List it in the view's filter_backends; :class:CursorPagination then pages in that order. ordering_fields holds the model's snake_case names, and may be nullable or span a relation (author__name). The value is a comma-separated list of terms; rows whose value is NULL sort last in both directions. An unlisted or malformed term raises :class:rn_forge.web.InvalidOrderBy, as does a repeated field.