{% 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'). {% endcomment %} {% if page_obj.paginator.num_pages > 1 or page_obj.num_pages > 1 %} {% endif %}