Files
santeh-ray/templates/catalog/_fragments/item-list.html
Azimkin 4a7f520037
All checks were successful
Build and Push Docker Image / build (push) Successful in 24s
feat: add pagination and color filter to catalog view and templates
- Implemented pagination for catalog items with Django's Paginator
- Updated `item-list.html` to include pagination controls
- Added color filtering logic to catalog view with support for `Color` model
- Enhanced `side-bar.html` with a dynamic color dropdown filter
- Adjusted filtering URL logic to accommodate color filters and pagination parameters
- Prefetched `colors` in item queries to optimize performance
2026-05-26 03:57:38 +02:00

19 lines
903 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<main class="item-list">
{% include "_fragments/item-grid.html" with items=page_obj empty_message="В этой категории пока нет товаров." %}
{% if paginator.num_pages > 1 %}
<nav class="catalog-pagination">
{% if page_obj.has_previous %}
<a href="?{{ pagination_query_string }}&page={{ page_obj.previous_page_number }}" class="catalog-pagination__btn">&laquo;</a>
{% endif %}
{% for i in paginator.page_range %}
<a href="?{{ pagination_query_string }}&page={{ i }}"
class="catalog-pagination__btn {% if i == page_obj.number %}active{% endif %}">{{ i }}</a>
{% endfor %}
{% if page_obj.has_next %}
<a href="?{{ pagination_query_string }}&page={{ page_obj.next_page_number }}" class="catalog-pagination__btn">&raquo;</a>
{% endif %}
</nav>
{% endif %}
</main>