You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
2.7 KiB

{% load template_filters %}
{% load i18n %}
{% if page_obj.paginator.num_pages > 1 %}
{% with path=request.path|without_page %}
<div class="pagination clearfix">
<div class="pg-info"> {% trans "Показано" %} {{ page_obj.start_index }} - {{ page_obj.end_index }} <i>{% blocktrans %}(всего {{ page_obj.paginator.count }} позиций){% endblocktrans %}</i></div>
<div class="pg-body">
{% if page_obj.has_previous %}
<a class="pg-prev" href="{{ path }}page/{{ page_obj.previous_page_number }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{% trans "Предыдущая" %}</a>
{% else %}
<a class="pg-prev disabled" href="#">{% trans "Предыдущая" %}</a>
{% endif %}
<ul>
{% if page_obj.number > 2 %}
<li><a href="{{ path }}page/{{ 1 }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{{ 1 }}</a></li>
{% if page_obj.number > 3 %}
<li>...</li>
{% endif %}
{% endif %}
{% if page_obj.has_previous %}
<li><a href="{{ path }}page/{{ page_obj.previous_page_number }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{{ page_obj.previous_page_number }}</a></li>
{% endif %}
<li><b>{{ page_obj.number }}</b></li>
{% if page_obj.has_next %}
<li><a href="{{ path }}page/{{ page_obj.next_page_number }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{{ page_obj.next_page_number }}</a></li>
{% endif %}
{% if page_obj.paginator.num_pages|subtract:page_obj.number > 1 %}
{% if page_obj.paginator.num_pages|subtract:page_obj.number > 2 %}
<li>...</li>
{% endif %}
<li><a href="{{ path }}page/{{ page_obj.paginator.num_pages }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{{ page_obj.paginator.num_pages }}</a></li>
{% endif %}
</ul>
{% if page_obj.has_next %}
<a class="pg-next" href="{{ path }}page/{{ page_obj.next_page_number }}/{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">{% trans "Следующая" %}</a>
{% else %}
<a class="pg-next disabled" href="#">{% trans "Следующая" %}</a>
{% endif %}
</div>
</div>
{% endwith %}
{% endif %}