feat: add pagination and color filter to catalog view and templates
All checks were successful
Build and Push Docker Image / build (push) Successful in 24s
All checks were successful
Build and Push Docker Image / build (push) Successful in 24s
- 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
This commit is contained in:
@@ -85,13 +85,19 @@
|
||||
<button type="submit" class="catalog-filter-submit">Применить</button>
|
||||
</section>
|
||||
|
||||
{% if available_colors %}
|
||||
<section class="a-section color-section">
|
||||
<h2>Цвет</h2>
|
||||
<select name="color" onchange="this.form.submit()">
|
||||
<option value="">Любой</option>
|
||||
{% for color in available_colors %}
|
||||
<option value="{{ color.id }}" {% if selected_color_id == color.id|stringformat:"i" %}selected{% endif %}>
|
||||
{{ color.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</section>
|
||||
|
||||
<section class="a-section material-section">
|
||||
<h2>Материал</h2>
|
||||
</section>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
<section class="a-section promotions-section">
|
||||
|
||||
Reference in New Issue
Block a user