delete index html change base.html , detail.html,list.html

master
Lowlights 2024-01-26 14:22:38 +06:00
parent 98769e9817
commit 9e229dff48
15 changed files with 179 additions and 227 deletions

4
.gitignore vendored
View File

@ -28,4 +28,6 @@ build/
# OS generated files # OS generated files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
.idea
/media

View File

@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-&b24xw3mg)lbuo4pdea^cxgkoc!yace&t^o9*o#n=-_jhwe+x!
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ['192.168.0.172', 'nitakushop.silkyway.kz'] ALLOWED_HOSTS = ['192.168.0.172', 'nitakushop.silkyway.kz','127.0.0.1']
# Application definition # Application definition

View File

@ -22,7 +22,7 @@ from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', views.index, name='index'), path('', views.product_list, name='product_list'),
path('', include('main.urls', namespace='main')), path('', include('main.urls', namespace='main')),
path('about/', views.about, name='about'), path('about/', views.about, name='about'),

Binary file not shown.

View File

@ -98,3 +98,4 @@ footer {
.footer-text span { .footer-text span {
color: #ff6b6b; /* Цвет для части текста */ color: #ff6b6b; /* Цвет для части текста */
} }

View File

@ -1,21 +1,124 @@
{% load static %} {% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="ru">
<head>
<meta charset="utf-8" />
<title>{% block title %}My shop{% endblock %}</title>
<link href="{% static "/deps/css/base.css" %}" rel="stylesheet">
</head>
<body>
<div id="header">
<a href="/" class="logo">Nitaku</a>
</div>
<div id="subheader">
</div> <head>
<div id="content"> <meta charset="UTF-8">
{% block content %} <meta http-equiv="X-UA-Compatible" content="IE=edge">
{% endblock %} <meta name="viewport" content="width=device-width, initial-scale=1.0">
</div> <link rel="stylesheet" href="{% static "/deps/css/bootstrap/bootstrap.min.css"%}">
</body> <link rel="stylesheet" href="{% static "/deps/css/my_css.css"%}">
</html> <!-- Стиль footer-a для главной страницы -->
<link rel="stylesheet" href="{% static "/deps/css/my_footer_css.css"%}">
<link rel="stylesheet" href="{% static "/deps/css/catal.css"%}">
<!-- Favicons for different platforms -->
<link rel="apple-touch-icon" sizes="180x180" href="{% static "/deps/favicon/apple-touch-icon.png"%}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static "/deps/favicon/favicon-32x32.png"%}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static "/deps/favicon/favicon-16x16.png"%}">
<link rel="manifest" href="{% static "/deps/favicon/site.webmanifest"%}">
<title>Главная</title>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="{% url "product_list"%}">Nitaku</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown ">
<a class="nav-link dropdown-toggle text-white" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Информация
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item text-white" href="https://t.me/silky_way_bot">Контактная информация</a></li>
<li><a class="dropdown-item text-white" href="{% url 'about' %}">Про нас</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<div class="row mt-1">
<div class="col-lg-2">
<!-- Пустой блок на Ваше усмотрение -->
</div>
<div id="header">
<h1><img src="{% static "deps/favicon/favicon.ico.png"%}" alt="Логотип"> <a class="navbar-brand" href="{% url "product_list"%}">Nitaku Shop</a></h1>
</div>
</div>
<!-- Добавление кнопок категорий и формы для фильтрации -->
{% block content %}
<div class="row mb-3">
<div class="col-12">
<form method="get" action="{% url 'main:product_list' %}">
<button type="submit" class="btn btn-primary">Искать по Категориям</button>
</form>
</div>
</div>
{% endblock %}
{# <div class="row">#}
{# {% for product in products %}#}
{# <div class="col-12 col-md-6 col-lg-4 p-4">#}
{# <div class="card border-primary rounded custom-shadow">#}
{# {% if product.image %}#}
{# <a href="{{ product.get_absolute_url }}"><div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">#}
{# <img src="{{ product.image.url }}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">#}
{# </div>#}
{# </a>#}
{# {% else %}#}
{# <div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">#}
{# <img src="{% static 'deps/img/no_image.jpg' %}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">#}
{# </div>#}
{# {% endif %}#}
{# <div class="card-body">#}
{# <a href="{{ product.get_absolute_url }}">#}
{# <p class="card-title">{{ product.name }}</p>#}
{# </a>#}
{# <p class="card-text text-truncate" style="color:wheat">{{ product.description }}</p>#}
{# <div class="d-flex justify-content-between">#}
{# <p><strong>{{ product.price }}₸</strong></p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# {% endfor %}#}
{# </div>#}
</div>
<footer class="py-2 bg-dark">
<div class="container">
<div class="row">
<div class="col-lg-14">
<p class="m-0 text-center text-white footer-text" style="font-size: 18px;">Nitaku shop <span>&</span> Silky Way 2024</p>
</div>
<div class="col-lg-14">
<div class="text-center mt-3">
<h5 class="text-white" style="font-size: 14px;">Посетите нашего телеграм бота!</h5>
<p class="text-white" style="font-size: 14px;">Распознавайте товары в картинах и найдите их онлайн.</p>
<a href="https://t.me/silky_way_bot" class="btn btn-warning" style="font-size: 14px;"> Silky Way </a>
</div>
</div>
</div>
</div>
</footer>
<script src="{% static "/deps/js/jquery/jquery-3.7.0.min.js"%}"></script>
<script src="{% static "/deps/js/jquery-events.js"%}"></script>
<script src="{% static "/deps/js/jquery-ajax.js"%}"></script>
<script src="{% static "/deps/js/bootstrap/bootstrap.bundle.min.js"%}"></script>
</body>
</html>

View File

@ -1,156 +0,0 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static "/deps/css/bootstrap/bootstrap.min.css"%}">
<link rel="stylesheet" href="{% static "/deps/css/my_css.css"%}">
<!-- Стиль footer-a для главной страницы -->
<link rel="stylesheet" href="{% static "/deps/css/my_footer_css.css"%}">
<link rel="stylesheet" href="{% static "/deps/css/catal.css"%}">
<!-- Favicons for different platforms -->
<link rel="apple-touch-icon" sizes="180x180" href="{% static "/deps/favicon/apple-touch-icon.png"%}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static "/deps/favicon/favicon-32x32.png"%}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static "/deps/favicon/favicon-16x16.png"%}">
<link rel="manifest" href="{% static "/deps/favicon/site.webmanifest"%}">
<title>Home</title>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="{% url "index"%}">Nitaku</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown ">
<a class="nav-link dropdown-toggle text-white" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Информация
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item text-white" href="https://t.me/silky_way_bot">Контактная информация</a></li>
<li><a class="dropdown-item text-white" href="{% url 'about' %}">Про нас</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<div class="row mt-1">
<div class="col-lg-2">
<!-- Пустой блок на Ваше усмотрение -->
</div>
<div id="header">
<h1><img src="{% static "deps/favicon/favicon.ico.png"%}" alt="Логотип"> <a class="navbar-brand" href="{% url "index"%}">Nitaku Shop</a></h1>
</div>
</div>
<div class="row">
{% for product in products %}
<div class="col-12 col-md-6 col-lg-4 p-4">
<div class="card border-primary rounded custom-shadow">
{% if product.image %}
<a href="{{ product.get_absolute_url }}"><div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">
<img src="{{ product.image.url }}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">
</div>
</a>
{% else %}
<!-- Заглушка или альтернативное содержимое для товаров без изображений -->
<div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">
<img src="{% static 'deps/img/no_image.jpg' %}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">
</div>
{% endif %}
<div class="card-body">
<a href="{{ product.get_absolute_url }}">
<p class="card-title">{{ product.name }}</p>
</a>
<p class="card-text text-truncate" style="color:wheat">{{ product.description }}</p>
<div class="d-flex justify-content-between">
<p><strong>{{ product.price }}₸</strong></p>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<section>
{# <div class="container">#}
{# <!-- Каталог и корзина с фиксированным расположением на странице -->#}
{##}
{# <!-- Карта товара -->#}
{# <div class="col-lg-4 col-md-6 p-4">#}
{# <div class="card border-primary rounded custom-shadow">#}
{# <img src="{% static "/deps/images/goods/O1CN01xsBTy51MVZ2HM1sjf_!!4200721440-0-cib.jpg"%}" class="card-img-top" alt="...">#}
{# <div class="card-body">#}
{# <a href="../goods/product.html">#}
{# <p class="card-title">Anime girl/p>#}
{# </a>#}
{# <p class="card-text text-truncate">Re Zero</p>#}
{##}
{# <div class="d-flex justify-content-between">#}
{##}
{# <p><strong>90.00 $</strong></p>#}
{##}
{# <!-- <p><strong>100.00 $</strong></p> -->#}
{##}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
{##}
{# </div>#}
{# </div>#}
{# </div>#}
{# <!-- Закончилась разметка модального окна -->#}
{# </div>#}
{# </div>#}
<!-- Контент -->
</section>
<footer class="py-2 bg-dark"> <!-- Уменьшаем высоту (padding) -->
<div class="container">
<div class="row">
<!-- Колонка для рекламного блока -->
<div class="col-lg-14">
<p class="m-0 text-center text-white footer-text" style="font-size: 18px;">Nitaku shop <span>&</span> Silky Way 2024</p> <!-- Изменяем размер шрифта -->
</div>
<!-- Колонка для рекламного блока -->
<div class="col-lg-14">
<div class="text-center mt-3">
<h5 class="text-white" style="font-size: 14px;">Посетите нашего телеграм бота!</h5>
<p class="text-white" style="font-size: 14px;">Распознавайте товары в картинах и найдите их онлайн.</p>
<a href="https://t.me/silky_way_bot" class="btn btn-warning" style="font-size: 14px;"> Silky Way </a>
</div>
</div>
</div>
</div>
</footer>
<script src="{% static "/deps/js/jquery/jquery-3.7.0.min.js"%}"></script>
<script src="{% static "/deps/js/jquery-events.js"%}"></script>
<script src="{% static "/deps/js/jquery-ajax.js"%}"></script>
<script src="{% static "/deps/js/bootstrap/bootstrap.bundle.min.js"%}"></script>
</body>
</html>

View File

@ -23,7 +23,7 @@
<header> <header>
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark"> <nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container"> <div class="container">
<a class="navbar-brand" href="{% url "index" %}">Nitaku Shop</a> <a class="navbar-brand" href="{% url "product_list" %}">Nitaku Shop</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
@ -50,7 +50,7 @@
<div class="container"> <div class="container">
<div class="row mt-4"> <div class="row mt-4">
<div id="header"> <div id="header">
<h1><img src="{% static "deps/favicon/favicon.ico.png"%}" alt="Логотип"> <a class="navbar-brand" href="{% url "index"%}">Nitaku Shop</a></h1> <h1><img src="{% static "deps/favicon/favicon.ico.png"%}" alt="Логотип"> <a class="navbar-brand" href="{% url "product_list"%}">Nitaku Shop</a></h1>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -97,7 +97,7 @@
<p class="text" style="color:wheat">{{ product.description }}</p> <p class="text" style="color:wheat">{{ product.description }}</p>
<p class="price" style="font-size: 35px; font-weight: bold; color: rgba(255,128,0,0.73);">{{ product.price }}₸</p> <p class="price" style="font-size: 35px; font-weight: bold; color: rgba(255,128,0,0.73);">{{ product.price }}₸</p>
<a href="{% url 'index' %}" class="btn btn-primary">Вернуться на главную</a> <a href="{% url 'product_list' %}" class="btn btn-primary">Вернуться на главную</a>
</div> </div>

View File

@ -1,35 +1,51 @@
{% extends "main/base.html" %} {% extends "main/base.html" %}
{% load static %} {% load static %}
{% block title %}
{% if category %}{{ category.name }}{% else %}Products{% endif %}
{% endblock %}
{% block content %} {% block content %}
<div id="sidebar"> <link rel="stylesheet" href="{% static "/deps/css/my_css.css"%}">
<h3>Categories</h3> <div id="sidebar" class="categories-sidebar">
<ul> <h3>Категории</h3>
<li {% if not category %}class="selected"{% endif %}> <div class="btn-group" role="group" aria-label="Категории">
<a href="{% url "main:product_list" %}">All</a> {% for c in categories %}
</li> <a href="{{ c.get_absolute_url }}" class="btn btn-secondary {% if category.slug == c.slug %}active{% endif %}">
{% for c in categories %} {{ c.name }}
<li {% if category.slug == c.slug %}class="selected" </a>
{% endif %}> {% endfor %}
<a href="{{ c.get_absolute_url }}">{{ c.name }}</a> </div>
</li> </div>
{% endfor %}
</ul>
</div> <div id="main" class="product-list">
<div id="main" class="product-list">
<h1>{% if category %}{{ category.name }}{% else %}Products <div class="row">
{% endif %}</h1> {% for product in products %}
{% for product in products %} {% if not category or product.category == category %}
<div class="item"> <div class="col-12 col-md-6 col-lg-4 p-4">
<a href="{{ product.get_absolute_url }}"> <div class="card border-primary rounded custom-shadow">
<img src="{% if product.image %}{{ product.image.url }}{% else %}{% static "deps/img/no_image.jpg" %}{% endif %}"> {% if product.image %}
</a> <a href="{{ product.get_absolute_url }}">
<a href="{{ product.get_absolute_url }}">{{ product.name }}</a> <div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">
<br> <img src="{{ product.image.url }}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">
${{ product.price }} </div>
</div> </a>
{% endfor %} {% else %}
</div> <div class="aspect-ratio overflow-hidden" style="position: relative; padding-top: 100%;">
{% endblock %} <img src="{% static 'deps/img/no_image.jpg' %}" class="w-100 h-100 position-absolute" style="object-fit: cover; top: 0; left: 0;" alt="{{ product.name }}">
</div>
{% endif %}
<div class="card-body">
<a href="{{ product.get_absolute_url }}">
<p class="card-title">{{ product.name }}</p>
</a>
<p class="card-text text-truncate" style="color: wheat">{{ product.description }}</p>
<div class="d-flex justify-content-between">
<p><strong>{{ product.price }}₸</strong></p>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -4,7 +4,7 @@ from . import views
app_name = 'main' app_name = 'main'
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'),
path('about/', views.about, name='about'), path('about/', views.about, name='about'),
path('products/', views.product_list, name='product_list'), path('products/', views.product_list, name='product_list'),
path('<slug:category_slug>/', views.product_list, path('<slug:category_slug>/', views.product_list,

View File

@ -2,21 +2,7 @@ from django.shortcuts import render,get_object_or_404
from django.http import HttpResponse from django.http import HttpResponse
from .models import Category, Product from .models import Category, Product
def index(request) -> HttpResponse:
context : dict = {
'title':'Home',
'contect' : 'Главная страница - HOME',
'list':['first','second'],
'dict' : {'first':1},
'is_authenticated':False
}
products = Product.objects.all()
categories = Category.objects.all()
# Merge the two dictionaries into one
context.update({'products': products, 'categories': categories})
return render(request, 'main/index.html', context)
def about(request): def about(request):
context = { context = {