Add order app, update base template, add user-agreement page and create orders list page
This commit is contained in:
parent
0a15637d35
commit
b8cc005afe
@ -37,6 +37,7 @@ INSTALLED_APPS = [
|
|||||||
'dev.apps.DevConfig',
|
'dev.apps.DevConfig',
|
||||||
'index.apps.IndexConfig',
|
'index.apps.IndexConfig',
|
||||||
'account.apps.AccountConfig',
|
'account.apps.AccountConfig',
|
||||||
|
'order.apps.OrderConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
@ -23,5 +23,6 @@ urlpatterns = [
|
|||||||
path('accounts/', include('django.contrib.auth.urls')),
|
path('accounts/', include('django.contrib.auth.urls')),
|
||||||
path('api/', include('api.urls')),
|
path('api/', include('api.urls')),
|
||||||
path('dev/', include('dev.urls')),
|
path('dev/', include('dev.urls')),
|
||||||
|
path('orders/', include('order.urls')),
|
||||||
path('', include('index.urls')),
|
path('', include('index.urls')),
|
||||||
]
|
]
|
||||||
|
0
order/__init__.py
Normal file
0
order/__init__.py
Normal file
3
order/admin.py
Normal file
3
order/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
order/apps.py
Normal file
6
order/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class OrderConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'order'
|
0
order/migrations/__init__.py
Normal file
0
order/migrations/__init__.py
Normal file
3
order/models.py
Normal file
3
order/models.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
3
order/tests.py
Normal file
3
order/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
29
order/urls.py
Normal file
29
order/urls.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
"""stall URL Configuration
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/3.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
Including another URLconf
|
||||||
|
1. Import the include() function: from django.urls import include, path
|
||||||
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
|
"""
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', views.orders_list, name='orders-list'),
|
||||||
|
# path('account', views.account, name='account'),
|
||||||
|
# path('account_<str:action>', views.account_action, name='account_action'),
|
||||||
|
#
|
||||||
|
# path('catalog/', views.catalog, name='catalog'),
|
||||||
|
# path('catalog/<int:product_id>/', views.product_view, name='product_view'),
|
||||||
|
# path('cart', views.cart, name='cart'),
|
||||||
|
]
|
||||||
|
|
5
order/views.py
Normal file
5
order/views.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
|
def orders_list(request):
|
||||||
|
return render(request, 'orders/orders-list.html')
|
BIN
static/fonts/Avenir.ttf
Normal file
BIN
static/fonts/Avenir.ttf
Normal file
Binary file not shown.
BIN
static/images/no_cover.png
Normal file
BIN
static/images/no_cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 813 KiB |
13
templates/orders/orders-list.html
Normal file
13
templates/orders/orders-list.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% block title %} Аккаунт | вход {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1> Ваш аккаунт </h1>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
тут должен быть список заказов...
|
||||||
|
{% else %}
|
||||||
|
<h3>Вы не можете просматривать заказы не войдя в аккаунт</h3>
|
||||||
|
Используйте меню аккаунта для регистрации или входа
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
49
templates/test_page.html
Normal file
49
templates/test_page.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% block title %} Лаба {% endblock %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
<style>
|
||||||
|
#example-content {
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#lab-content {
|
||||||
|
border: 1px solid green;
|
||||||
|
margin: 3em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1> Страница для выполнения лабы </h1>
|
||||||
|
|
||||||
|
<div id="example-content">
|
||||||
|
<span id="c">Тут будет текст из JS</span>
|
||||||
|
<script>
|
||||||
|
let tcolor = prompt("Введите цвет текста (стиль CSS)", "red")
|
||||||
|
document.getElementById("c").innerHTML = `Вы выбрали цвет текста: <span style="color: ${tcolor}">${tcolor}</span>`
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="lab-content">
|
||||||
|
<table id="mul-table"></table>
|
||||||
|
<script>
|
||||||
|
let table = document.getElementById("mul-table")
|
||||||
|
let html = "<tbody>"
|
||||||
|
for (let y = 1; y <= 10; y++) {
|
||||||
|
html += "<tr>"
|
||||||
|
for (let x = 1; x < 10; x++) {
|
||||||
|
let color = "#" + Math.round(Math.random() * 0xFFFFFF).toString(16)
|
||||||
|
html += `<td style="background: ${color}">${x * y}</td>`
|
||||||
|
}
|
||||||
|
html += "</tr>"
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</tbody>"
|
||||||
|
|
||||||
|
table.innerHTML = html
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
30
templates/user-agreement.html
Normal file
30
templates/user-agreement.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% block title %} Аккаунт | пользовательское соглашение {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1> Пользовательское соглашение </h1>
|
||||||
|
|
||||||
|
<div id="user-agreement-container">
|
||||||
|
|
||||||
|
<h3>Пункт пользовательского соглашения</h3>
|
||||||
|
<p>
|
||||||
|
Параграф, какой-то текст. Нумерованный список:
|
||||||
|
|
||||||
|
</p>
|
||||||
|
<!-- списки лучше делать вне параграфов. можно конечно все в параграф ебашить, но лучше не надо -->
|
||||||
|
<ol>
|
||||||
|
<li>1 пункт списка</li>
|
||||||
|
<li>2 пункт списка</li>
|
||||||
|
<li>3 пункт списка</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Параграф, еще какой-то текст. Ненумерованный список:
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>пункт ненумерованного списка</li>
|
||||||
|
<li>пункт ненумерованного списка</li>
|
||||||
|
<li>пункт ненумерованного списка</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Reference in New Issue
Block a user