PaginationMixin

class djcrud.views.pagination.PaginationMixin[source]

Bases: object

Page size and page navigation for list views.

Pagination is stable: if the queryset has no ordering, a default order_by("pk") is applied before handing it to Django’s paginator. This eliminates UnorderedObjectListWarning and prevents rows from appearing on multiple pages or being skipped.

For best results and to control the natural sort order (newest first, etc.), define class Meta: ordering = [...] on your models.

paginate_by

Default rows per page. None disables pagination.

Type:

int | None

per_page_options

Comma-separated allowed page sizes for the per-page selector.

Type:

str

page_kwarg

GET parameter for the current page number.

Type:

str

per_page_kwarg

GET parameter for the selected page size.

Type:

str

pagination_target

Unpoly up-target for pagination controls.

Type:

str

get_paginate_by(queryset=None)[source]

Rows per page from GET or paginate_by default.

property resolved_per_page

Validated page size from GET or paginate_by.

property page

Current Page object, if paginated.

property paginator

Paginator for the current list queryset.

pagination_url(page_number)[source]

URL for page_number preserving other GET parameters.

property pagination_form_attributes

HTML attributes for pagination control forms.

property per_page_option_list

Allowed page sizes from per_page_options.