{% load brickwork_icons i18n %} {% comment %} Pagination controls. Renders nothing when there is only one page, or when page_obj is absent (STA-014: a one-page result shows no controls). Uses logical prev/next (chevron-back/-forward flip under RTL, ICO-014). Preserves the current sort and filter params so they survive a page change. TBL-004 (icvoss/django-brickwork#217): page_obj accepts either a real django.core.paginator.Page, or any duck-typed object presenting the same attributes FLAT: number, num_pages, has_previous, has_next, previous_page_number, next_page_number. num_pages is read either nested (page_obj.paginator.num_pages, the Page shape) or flat (page_obj.num_pages, the duck-typed shape); every other attribute is already flat on both shapes. The one-page/absent-page_obj render-nothing contract above is unchanged for either shape. The `page_param` rename ask from #217 is deferred by recorded issue-comment ruling: this component does not add it. #41: when ``request`` is in context (the view/pattern path) the built-in ``{% querystring %}`` tag overrides only ``page`` and keeps every other current GET param (sort, filters), so the pattern owns the sort/pagination split with no consumer-supplied ``querystring``. Standalone renders with no request fall back to the documented ``querystring`` var (the current GET minus ``page``), so the component's request-free render contract is unchanged. Required context: page_obj (a Page, or a flat duck-typed equivalent, see above). Optional: querystring (the request-free fallback: the current GET params minus 'page'). States: rendered / not-rendered (a single page or an absent page_obj renders nothing at all, STA-014), and per-link enabled/disabled (the previous/next control is a real anchor when a page exists in that direction, or a non-navigable disabled span with aria-disabled otherwise, the same disabled-link pattern _button.html uses). Accessibility: the whole control is a landmark nav (aria-label "Pagination"); prev/next icons are decorative, with the direction meaning carried by rel="prev"/rel="next" and the aria-label text, and they flip under RTL (logical chevron-back/-forward icon names). Covered by axe.spec.mjs against list-*.html (app/list.html's own paginated table). Responsive: no breakpoint switch; no width-dependent CSS on any .bw-pagination* selector. {% endcomment %} {% if page_obj.paginator.num_pages > 1 or page_obj.num_pages > 1 %} {% endif %}