Pagination
Description
Previous / next links under a paged listing. Renders nothing if neither is set.
Pass page_obj (from Paginator.get_page()) and the links are built
for you as ?page=N. Pass query (usually request.GET) to keep
the listing's other query params, such as a tag filter, on those links.
Explicit previous_url / next_url still work and win.
Usage
Explicit links
Without a paginator, pass the links yourself. See the "From a paginator" variant for page_obj (a paginator page can't be previewed here, only in that variant).
{% pagination previous_url="?page=1" next_url="?page=3" %}
Qualified tag usage
{% ui__pagination previous_url="?page=1" next_url="?page=3" %}
Parameters
| Name | Type | Requirement | Default | Choices | Description |
|---|---|---|---|---|---|
page_obj
|
Page
|
Optional | — | — | The current page of a Paginator. |
query
|
dict
|
Optional | — | — | Query params to keep on the links. |
previous_url
|
str
|
Optional | — | — | Link to the previous page. |
next_url
|
str
|
Optional | — | — | Link to the next page. |
Select variant preset
Background colour
Viewport width
Zoom level
{% pagination previous_url="?page=1" next_url="?page=3" %}
<nav class="pagination " aria-label="Pages">
<a class="pagination__link" href="?page=1" rel="prev">← Previous</a>
<a class="pagination__link pagination__link--next"
href="?page=3"
rel="next">Next →</a>
</nav>