24 lines
1.1 KiB
HTML
24 lines
1.1 KiB
HTML
{% if is_paginated %}
|
|
<nav aria-label="Page navigation" class="mt-4">
|
|
<ul class="pagination justify-content-center">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">«</a></li>
|
|
{% else %}
|
|
<li class="page-item disabled"><span class="page-link">«</span></li>
|
|
{% endif %}
|
|
{% for num in page_obj.paginator.page_range %}
|
|
{% if page_obj.number == num %}
|
|
<li class="page-item active"><span class="page-link">{{ num }}</span></li>
|
|
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ num }}">{{ num }}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if page_obj.has_next %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">»</a></li>
|
|
{% else %}
|
|
<li class="page-item disabled"><span class="page-link">»</span></li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|