86 lines
8.6 KiB
HTML
86 lines
8.6 KiB
HTML
|
|
{% load static %}
|
||
|
|
|
||
|
|
{% if page_obj.has_other_pages %}
|
||
|
|
<div class="mt-0 mt-lg-3">
|
||
|
|
<div class="pagination justify-content-center">
|
||
|
|
<ul class="d-flex justify-content-center gap-2">
|
||
|
|
<li>
|
||
|
|
{% if page_obj.has_previous %}
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page=1" class="pag-prev">
|
||
|
|
<svg>
|
||
|
|
<use xlink:href="{% static 'img/icons/icons.svg' %}?v=1#pag-prev"></use>
|
||
|
|
</svg>
|
||
|
|
|
||
|
|
</a>
|
||
|
|
{% else %}
|
||
|
|
<a href="#" class="pag-prev pag-disabled" disables>
|
||
|
|
<svg>
|
||
|
|
<use xlink:href="{% static 'img/icons/icons.svg' %}?v=1#pag-prev"></use>
|
||
|
|
</svg>
|
||
|
|
</a>
|
||
|
|
{% endif %}
|
||
|
|
</li>
|
||
|
|
|
||
|
|
{% for i in page_obj.paginator.page_range %}
|
||
|
|
{% if page_obj.number > 1 and page_obj.number <= page_obj.paginator.num_pages|add:-2%}
|
||
|
|
{% if page_obj.number == i %}
|
||
|
|
<li>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page current">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% elif i >= page_obj.number|add:-1 and i <= page_obj.number|add:2 %}
|
||
|
|
<li {% if i == page_obj.number|add:2 %}class="d-none d-sm-flex"{% endif %}>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% endif %}
|
||
|
|
{% elif page_obj.number == page_obj.paginator.num_pages|add:-1%}
|
||
|
|
{% if page_obj.number == i %}
|
||
|
|
<li>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page current">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% elif i >= page_obj.number|add:-2 and i <= page_obj.number|add:1 %}
|
||
|
|
<li {% if i == page_obj.paginator.num_pages|add:-3 %}class="d-none d-sm-flex"{% endif %}>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% endif %}
|
||
|
|
{% elif page_obj.number == page_obj.paginator.num_pages %}
|
||
|
|
{% if page_obj.number == i %}
|
||
|
|
<li>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page current">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% elif i >= page_obj.number|add:-3%}
|
||
|
|
<li {% if i == page_obj.paginator.num_pages|add:-3 %}class="d-none d-sm-flex"{% endif %}>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% endif %}
|
||
|
|
{% elif page_obj.number == 1%}
|
||
|
|
{% if page_obj.number == i %}
|
||
|
|
<li>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page current">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% elif i <= page_obj.number|add:3 %}
|
||
|
|
<li {% if i == 4 %}class="d-none d-sm-flex"{% endif %}>
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ i }}" class="pag-page">{{ i }}</a>
|
||
|
|
</li>
|
||
|
|
{% endif %}
|
||
|
|
{% endif %}
|
||
|
|
{% endfor %}
|
||
|
|
|
||
|
|
<li>
|
||
|
|
{% if page_obj.has_next %}
|
||
|
|
<a href="?{% if sort_query %}sort={{ sort_query }}{% endif %}{% if filter_query %}&filter={{ filter_query }}{% endif %}{% if brand_query %}&brand={{ brand_query }}{% endif %}{% if model_query %}&model={{ model_query }}{% endif %}{% if year_min_query %}&year_min={{ year_min_query }}{% endif %}{% if year_max_query %}&year_max={{ year_max_query }}{% endif %}{% if price_min_query %}&price_min={{ price_min_query }}{% endif %}{% if price_max_query %}&price_max={{ price_max_query }}{% endif %}&page={{ page_obj.paginator.num_pages }}" class="pag-next">
|
||
|
|
<svg>
|
||
|
|
<use xlink:href="{% static 'img/icons/icons.svg' %}?v=1#pag-next"></use>
|
||
|
|
</svg>
|
||
|
|
</a>
|
||
|
|
{% else %}
|
||
|
|
<a href="#" class="pag-next pag-disabled" disables>
|
||
|
|
<svg>
|
||
|
|
<use xlink:href="{% static 'img/icons/icons.svg' %}?v=1#pag-next"></use>
|
||
|
|
</svg>
|
||
|
|
</a>
|
||
|
|
{% endif %}
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endif %}
|