Ver código fonte

Добавление товаров

Nikita 1 ano atrás
pai
commit
466a69488d

BIN
shop/db.sqlite3


BIN
shop/media/image/chrome-hearts-horse-shoe-logo-pocket-t-shirt-black-700x700.jpg


+ 1 - 5
shop/site_shop/templates/accounts/profile.html

@@ -1,13 +1,9 @@
 {% extends 'base.html' %}
 
-{% block title %}Профиль{% endblock %}
-
-
-
 {% block content %}
 {% if user.is_authenticated %}
 <h1>Профиль</h1>
-    <p>{{user.email}}</p>
+<a href="{% url 'add' %}">Добавить товар</a>
 {% else %}
 <p>Вы не вошли в систему!</p>
 {% endif %}

+ 0 - 2
shop/site_shop/templates/add.html

@@ -1,7 +1,5 @@
 {% extends "base.html" %}
 
-{% block title %} Добавление товара {% endblock %}
-
 {% block content %}
     {% if user.is_authenticated %}
 

+ 3 - 3
shop/site_shop/templates/base.html

@@ -7,18 +7,18 @@
     <meta name="viewport"
           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>{% block title %} {% endblock %}</title>
+    <title></title>
 </head>
 <body>
     <header>
-        <a href="{% url 'index' %}">Главная страница</a>
+        <a href="{% url 'index' %}">Главная</a>
         <a href="{% url 'services' %}">Товары</a>
         {% if user.is_authenticated %}
         <a href="{% url 'profile' %}">Профиль</a>
         <a href="{% url 'logout' %}">Выход</a>
         {% else %}
-        <a href="{% url 'register' %}">Регистрация</a>
         <a href="{% url 'login' %}">Вход</a>
+        <a href="{% url 'register' %}">Регистрация</a>
         {% endif %}
     </header>
 

+ 0 - 1
shop/site_shop/templates/detail.html

@@ -1,6 +1,5 @@
 {% extends "base.html" %}
 
-{% block title %}{{ service.name }}{% endblock %}
 
 {% block content %}
     <div>

+ 0 - 2
shop/site_shop/templates/index.html

@@ -1,7 +1,5 @@
 {% extends 'base.html' %}
 
-{% block title %}Главная{% endblock %}
-
 {% block content %}
 <h1>Главная страница</h1>
     {% for service in service_list%}

+ 0 - 2
shop/site_shop/templates/login.html

@@ -1,7 +1,5 @@
 {% extends "base.html" %}
 
-{% block title %} Авторизация {% endblock %}
-
 {% block content %}
 
     <h3>Вход</h3>

+ 0 - 1
shop/site_shop/templates/registration.html

@@ -1,6 +1,5 @@
 {% extends 'base.html' %}
 
-{% block title %} Регистрация {% endblock %}
 
 {% block content %}
 <h1>Регистрация</h1>

+ 1 - 4
shop/site_shop/templates/services.html

@@ -1,11 +1,8 @@
 {% extends 'base.html' %}
 
-{% block title %}Товары{% endblock %}
-
 {% block content %}
-    <h1>Все товары</h1>
+    <h1>Товары</h1>
     {% if user.is_staff %}
-    <a href="{% url 'add' %}">Добавить товар</a>
     {% endif %}
     {% for service in service_list%}
         <div>

+ 5 - 6
shop/site_shop/urls.py

@@ -3,12 +3,11 @@ from .views import index, login_view, services, profile, logout_view, register,
 
 urlpatterns = [
     path('', index.as_view(), name = 'index'),
+    path('profile/', profile, name = 'profile'),
     path('login/', login_view, name = 'login'),
+    path('logout/', logout_view, name='logout'),
+    path('register/', register, name='register'),
+    path('add/', add, name='add'),
+    path('detail/<int:pk>', DetailRequest.as_view(), name='detail'),
     path('services/', services.as_view(), name = 'services'),
-    path('profile/', profile, name = 'profile'),
-    path('register/', register, name = 'register'),
-    path('logout/', logout_view, name = 'logout'),
-    path('add/', add, name = 'add'),
-    path('detail/<int:pk>', DetailRequest.as_view(), name = 'detail'),
-
 ]