All checks were successful
Build and Push Docker Image / build (push) Successful in 30s
- Introduced `Subcategory` model with migration and unique slug constraint per category - Enabled subcategory assignment for items with validation to ensure category matching - Updated catalog views to handle subcategories, filtering items accordingly - Enhanced templates (`index.html`, `side-bar.html`, `item-list.html`, `detail.html`) to display subcategories - Added dynamic subcategory dropdown in Django admin with category filtering - Created JavaScript for admin subcategory handling and AJAX population - Wrote comprehensive tests for subcategory functionality in views and admin
54 lines
2.0 KiB
HTML
54 lines
2.0 KiB
HTML
<aside>
|
||
<section class="categories a-section">
|
||
<h2>Категории</h2>
|
||
<a href="/catalog/" class="category {% if selected_category.id == None %}active{% endif %}">Все товары</a>
|
||
{% for category in categories %}
|
||
<a href="/catalog/{{ category.slug }}/" class="category {% if selected_category.id == category.slug %}active{% endif %}">
|
||
{{ category.name }}
|
||
</a>
|
||
{% empty %}
|
||
<p class="categories-empty">Категории пока не добавлены.</p>
|
||
{% endfor %}
|
||
</section>
|
||
|
||
<section class="sub-categories a-section">
|
||
<h2>Подкатегории</h2>
|
||
{% if selected_category.id != None %}
|
||
<a href="/catalog/{{ selected_category.id }}/" class="category {% if selected_subcategory.id == None %}active{% endif %}">
|
||
Все подкатегории
|
||
</a>
|
||
{% for subcategory in subcategories %}
|
||
<a href="/catalog/{{ selected_category.id }}/?subcategory={{ subcategory.slug }}" class="category {% if selected_subcategory.id == subcategory.slug %}active{% endif %}">
|
||
{{ subcategory.name }}
|
||
</a>
|
||
{% empty %}
|
||
<p class="categories-empty">Подкатегории пока не добавлены.</p>
|
||
{% endfor %}
|
||
{% else %}
|
||
<p class="categories-empty">Выберите категорию.</p>
|
||
{% endif %}
|
||
</section>
|
||
|
||
<form action="">
|
||
<section class="a-section cost-section">
|
||
<h2>Стоимость</h2>
|
||
</section>
|
||
|
||
<section class="a-section color-section">
|
||
<h2>Цвет</h2>
|
||
</section>
|
||
|
||
<section class="a-section material-section">
|
||
<h2>Материал</h2>
|
||
</section>
|
||
|
||
<section class="a-section promotions-section">
|
||
<h2>Акции</h2>
|
||
</section>
|
||
|
||
<section class="a-section new-section">
|
||
<h2>Новинки</h2>
|
||
</section>
|
||
</form>
|
||
</aside>
|