feat: add sidebar and item list to catalog page, enable DEBUG mode for development
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
- Created `side-bar.html` and `item-list.html` fragments for catalog page layout - Updated `catalog/index.html` to include sidebar and item list templates - Added styles for catalog layout in `catalog.css` - Enabled `DEBUG=True` in settings for local development - Adjusted CSS in shipping and services for consistent spacing
This commit is contained in:
@@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|||||||
from django.http import HttpRequest, HttpResponse, Http404
|
from django.http import HttpRequest, HttpResponse, Http404
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
|
|
||||||
from items.models import Category
|
from items.models import Category, Item
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
@@ -25,5 +25,6 @@ def index(request: HttpRequest, category: str | None = None) -> HttpResponse:
|
|||||||
|
|
||||||
return render(request, 'catalog/index.html', {
|
return render(request, 'catalog/index.html', {
|
||||||
'categories': Category.objects.all(),
|
'categories': Category.objects.all(),
|
||||||
|
'items': Item.objects.all(),
|
||||||
'selected_category': selected_category
|
'selected_category': selected_category
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
SECRET_KEY = 'django-insecure-*%u*i415=%@ny05mbd-j3802bcl!(0nwa3#^yxnor)7nd(w7%q'
|
SECRET_KEY = 'django-insecure-*%u*i415=%@ny05mbd-j3802bcl!(0nwa3#^yxnor)7nd(w7%q'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = [
|
ALLOWED_HOSTS = [
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
aside {
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
.large {
|
.large {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
padding-bottom: 130px;
|
margin-bottom: 130px;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -153,5 +153,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.shipping-content {
|
.shipping-content {
|
||||||
padding-bottom: 120px;
|
margin-bottom: 120px;
|
||||||
}
|
}
|
||||||
6
templates/catalog/_fragments/item-list.html
Normal file
6
templates/catalog/_fragments/item-list.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<main class="item-list">
|
||||||
|
{% for item in items %}
|
||||||
|
<h1>item</h1>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</main>
|
||||||
38
templates/catalog/_fragments/side-bar.html
Normal file
38
templates/catalog/_fragments/side-bar.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<aside>
|
||||||
|
<section class="categories a-section">
|
||||||
|
<h2>Категории</h2>
|
||||||
|
{% for category in categories %}
|
||||||
|
<a href="/catalog/{{ category.slug }}" class="category">{{ category.name }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="sub-categories a-section">
|
||||||
|
<h2>Подкатегории</h2>
|
||||||
|
</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>
|
||||||
@@ -10,10 +10,18 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<!-- HEADER -->
|
<!-- HEADER -->
|
||||||
{% include "_fragments/header.html" with active="catalog" %}
|
{% include "_fragments/header.html" with active="catalog" %}
|
||||||
|
|
||||||
{% if selected_category.id == None %}
|
{% if selected_category.id == None %}
|
||||||
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/catalog/' text_2='Каталог' %}
|
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/catalog/' text_2='Каталог' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/catalog/' text_2='Каталог' text_3=selected_category.name %}
|
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/catalog/' text_2='Каталог' text_3=selected_category.name %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="container catalog-container">
|
||||||
|
{% include 'catalog/_fragments/side-bar.html' with categories=categories %}
|
||||||
|
|
||||||
|
{% include 'catalog/_fragments/item-list.html' with items=items %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% include "_fragments/footer.html" %}
|
{% include "_fragments/footer.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user