{% if paginator.has_other_pages %} <nav aria-label="{{aria_label}}"> <ul class="pagination"> {% if paginator.has_previous %} <li class="page-item"><a class="page-link" href="?{{get_param}}={{paginator.previous_page_number}}">«</a></li> {% else %} <li class="page-item disabled"><span class="page-link">«</span></li> {% endif %} {% for i in paginator.paginator.page_range %} {% if i <= paginator.number|add:5 and i >= paginator.number|add:-5 %} {% if i == paginator.number %} <li class="page-item active"><a class="page-link" href="?{{get_param}}={{i}}">{{i}}</a></li> {% else %} <li class="page-item"><a class="page-link" href="?{{get_param}}={{i}}">{{i}}</a></li> {% endif %} {% endif %} {% endfor %} {% if paginator.has_next %} <li class="page-item"><a class="page-link" href="?{{get_param}}={{paginator.next_page_number}}">»</a></li> {% else %} <li class="page-item disabled"><span class="page-link">»</span></li> {% endif %} </ul> </nav> {% endif %}