This commit is contained in:
relaxed 2024-08-18 03:34:33 +05:00
commit 8851786e67
353 changed files with 36724 additions and 0 deletions

0
adminsystemdb/__init__.py Executable file
View file

5
adminsystemdb/admin.py Executable file
View file

@ -0,0 +1,5 @@
from django.contrib import admin
from .models import Poseters
# Register your models here.
admin.site.register(Poseters)

6
adminsystemdb/apps.py Executable file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class AdminsystemdbConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'adminsystemdb'

View file

@ -0,0 +1,25 @@
# Generated by Django 4.1.6 on 2023-04-17 06:09
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Poseters',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('papka', models.CharField(max_length=20, verbose_name='papka')),
('title', models.TextField(verbose_name='tilte')),
('authror', models.TextField(verbose_name='author')),
('date', models.CharField(max_length=40, verbose_name='date')),
('content', models.TextField(verbose_name='render content')),
],
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 4.1.6 on 2023-04-17 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminsystemdb', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='poseters',
name='desc',
field=models.TextField(default=str, verbose_name='desctiption'),
preserve_default=False,
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.1.6 on 2023-04-17 07:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminsystemdb', '0002_poseters_desc'),
]
operations = [
migrations.AlterField(
model_name='poseters',
name='authror',
field=models.TextField(blank=True, verbose_name='author'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 4.1.6 on 2023-04-22 19:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminsystemdb', '0003_alter_poseters_authror'),
]
operations = [
migrations.AddField(
model_name='poseters',
name='img_preview',
field=models.TextField(blank=True, verbose_name='img_preview'),
),
]

View file

13
adminsystemdb/models.py Executable file
View file

@ -0,0 +1,13 @@
from django.db import models
# Create your models here.
class Poseters(models.Model):
papka = models.CharField("papka", max_length=20)
title = models.TextField("tilte")
authror = models.TextField("author", blank=True)
date = models.CharField("date", max_length=40)
content = models.TextField("render content")
desc = models.TextField("desctiption")
img_preview = models.TextField("img_preview", blank=True)
def __str__(self) -> str:
return self.title

View file

@ -0,0 +1,64 @@
const form = document.querySelector("form");
let list_preview = "[";
let postname = "";
let authtor = "";
form.addEventListener("submit", (e) => {
e.preventDefault();
const foromdata = new FormData(form);
for (intem of foromdata) {
console.log(intem[0], intem[1]);
}
fetch("get_res", {
method: "POST",
body: foromdata,
})
.then((res) => res.json())
.then((res) => {
document.getElementById("header").value = "";
document.getElementById("text").value = "";
document.getElementById("img").value = "";
document.getElementById("log").value += res["text"];
list_preview += res["list_preview"];
document.getElementById("post_namee").value = res["postname"];
document.getElementById("authtorr").value = res["authtor"];
document.getElementById("to_list").value = list_preview + "]";
console.log(list_preview);
foromdata.append("tolist", list_preview + "]");
fetch("getlist", {
method: "POST",
body: foromdata,
})
.then((res) => res.json())
.then((res) => {
console.log(list_preview);
});
});
});
function go_to_preview() {
try {
const foromdata = new FormData(form);
foromdata.append("tolist", list_preview + "]");
fetch("get_res/preview", {
method: "POST",
body: foromdata,
});
} catch (error) {
console.log(error);
}
}
function clear_all() {
list_preview = "[";
document.getElementById("header").value = "";
document.getElementById("text").value = "";
document.getElementById("log").value = "";
document.getElementById("post_name").value = "";
document.getElementById("post_name").value = "";
document.getElementById("desc").value = "";
document.getElementById("img").value = "";
document.getElementById("authtor").value = "";
}

View file

@ -0,0 +1,666 @@
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
:focus {
outline: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
-webkit-appearance: none;
-moz-appearance: none;
}
input[type="search"] {
-webkit-appearance: none;
-moz-appearance: none;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
textarea {
overflow: auto;
vertical-align: top;
resize: vertical;
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
max-width: 100%;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden] {
display: none;
}
html {
font-size: 100%; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
a:focus {
outline: thin dotted;
}
a:active,
a:hover {
outline: 0;
}
img {
border: 0; /* 1 */
-ms-interpolation-mode: bicubic; /* 2 */
}
figure {
margin: 0;
}
form {
margin: 0;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0; /* 1 */
padding: 0;
white-space: normal; /* 2 */
*margin-left: -7px; /* 3 */
}
button,
input,
select,
textarea {
font-size: 100%; /* 1 */
margin: 0; /* 2 */
vertical-align: baseline; /* 3 */
*vertical-align: middle; /* 3 */
}
button,
input {
line-height: normal;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
*overflow: visible; /* 4 */
}
button[disabled],
html input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
*height: 13px; /* 3 */
*width: 13px; /* 3 */
}
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
table {
border-collapse: collapse;
border-spacing: 0;
}
html,
button,
input,
select,
textarea {
color: #222;
}
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
img {
vertical-align: middle;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
textarea {
resize: vertical;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
html {
box-sizing: border-box;
height: 100%;
scroll-behavior: smooth;
}
*,
*::after,
*::before {
box-sizing: inherit;
}
body {
display: flex;
flex-direction: column;
font-family: "Roboto", sans-serif;
font-size: 16px;
line-height: 1.2;
height: 100%;
}
.container {
width: 100%;
max-width: 1000px;
margin: 0 auto;
height: 100%;
padding: 0 0px;
text-align: center;
}
.header {
flex: 0 0 auto;
background-color: #212429;
margin-top: 75px;
}
.header h1 {
text-align: center;
color: #fff;
font-size: 30px;
font-weight: bold;
}
.main {
background-color: white;
flex: 1 0 auto;
}
.footer {
background-color: #212429;
flex: 0 0 auto;
}
.content {
padding: 75px 0;
font-size: 25px;
}
.n_bar{
max-width: 175px;
width: 300px;
height: 100%;
margin: 0;
float: left;
font-size: auto;
}
.in_content{
max-width: 1000px;
width: 650px;
margin-left: 50px;
/* display: inline; */
height: 100%;
text-align: left;
float: left;
}
.button2 {
align-items: center;
background-color: rgba(255, 255, 255, 0.7);
color: #000000;
cursor: pointer;
display: flex;
font-family: ui-sans-serif,system-ui,-apple-system,system-ui,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
font-size: 12px;
font-weight: 700;
line-height: 1.5;
text-decoration: none;
text-transform: uppercase;
outline: 0;
border: 0;
/* padding: 1rem; */
/* margin-bottom: 20px; */
margin-top: 20px;
}
.button2:before {
background-color: #000000;
content: "";
display: inline-block;
height: 1px;
margin-right: 0px;
transition: all .42s cubic-bezier(.25,.8,.25,1);
width: 0;
}
.button2:hover:before {
background-color: #000000;
width: 3rem;
}
.gkod_team_label {
font-size: 50px;
}
p {
margin-bottom: 40px;
}
.logo_img {
width: auto;
height: 70px;
margin-bottom: 40px;
}
.title_img{
margin-top: 50px;
max-width: 100%;
}
.footer .content {
color: #80808080;
}
.navbar {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 75px;
background: white;
border-bottom: 2px solid #e2e8f0;
/* #252850; */
}
.navbar__wrap {
display: flex;
justify-content: space-between;
height: 100%;
}
.hamb {
display: none;
}
.popup {
display: none;
}
.logo {
text-decoration: none;
color: #fff;
font-size: 20px;
font-weight: bold;
text-transform: uppercase;
display: flex;
align-items: center;
}
.menu > li > a {
text-decoration: none;
}
.navbar__wrap .menu {
display: none;
}
.navbar__wrap .menu > li {
display: flex;
align-items: stretch;
}
.navbar__wrap .menu > li > a {
display: flex;
align-items: center;
padding: 0 20px;
/* color: rgba(255, 255, 255, 0.7); */
color: #000000;
}
.navbar__wrap .menu > li > a:hover {
/* color: rgba(255, 255, 255, 1); */
/* color: #252850; */
background-color: #252850;
color: white;
}
.menu2 > li > a {
text-decoration: none;
}
.navbar__wrap .menu2 {
display: flex;
}
.navbar__wrap .menu2 > li {
display: flex;
align-items: stretch;
}
.navbar__wrap .menu2 > li > a {
display: flex;
align-items: center;
padding: 0 20px;
/* color: rgba(255, 255, 255, 0.7); */
color: #000000;
}
.navbar__wrap .menu2 > li > a:hover {
/* color: rgba(255, 255, 255, 1); */
/* color: #252850; */
background-color: #252850;
color: white;
}
.title_logo:hover {
cursor: pointer;
}
/* .more_butt{
width: 150px;
height: 35px;
background-color: rgba(107, 107, 107, 0.5);
color: white;
border-radius: 15px;
border-color: rgba(107, 107, 107);
font-size: 20px;
margin-top: 20px;
}
.more_butt:hover{
background-color: #C89365;
color: black;
} */
.more_butt {
margin-top: 20px;
margin-bottom: 20px;
width: 200px;
background-color: #252850;
font-size: 15px;
/* background: transparent; */
/* padding: 1em 1.5em; */
/* #C89365; */
padding: 10px 20px;
color: #ffffff;
text-transform: uppercase;
transition: .5s ease;
border: none;
}
.img_content{
border-radius: 15px;
border-color: rgba(107, 107, 107);
border: 2px;
margin-top: 20px;
height: auto;
width: 100%;
}
.gkod_team_label {
font-size: 30px;
}
.selected{
background-color: #252850;
}
.card {
width: 100%;
max-height: 300px;
height: 300px;
text-align: center;
background-color: #C89365;
}
.card_img{
width: 50%;
height: 300px;
float: left;
}
.card_text{
width: 50%;
max-height: 300px;
height: 300px;
float: left;
display: flex;
align-items: center;
}
.card_in_img{
width: auto;
height: 100%;
float: left;
}
.card_in_text{
height: auto;
margin: 0 auto;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding-left: 14px;
padding-right: 14px;
padding-top: 14px;
padding-bottom: 14px;
font-size: 22px;
}

BIN
adminsystemdb/static/tmp/z10.JPG Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

BIN
adminsystemdb/static/tmp/zz10.JPG Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

View file

@ -0,0 +1,254 @@
{% 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 'loginedtest/style.css' %}">
<link rel="stylesheet" href="{% static 'first/style.css' %}" />
<title>Preview</title>
</head>
<body>
<nav class="navbar">
<div class="container">
<div class="navbar__wrap">
<div class="hamb">
<div class="hamb__field" id="hamb">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
</div>
<div class="coltxt" onclick="window.location.href='{% url 'home' %}'">
<div style="width: 100%; font-size: 30px; align-self: center; height: 30px;" class="cool_text">
<div id="one" style="margin-left: 10px; padding-left: 10px;">E</div>
<div id="two"><div id="twoo">КАТЕРИНБУРГ</div></div>
<div id="three" style="color: blue;">G</div>
<div id="four"><div id="fourr">UIDE</div></div>
</div>
</div>
<div class="mobile_coltxt" onclick="window.location.href='/'">
<label>EKB</label><label style="color: blue; padding-left: 0px; margin-left: 10px; margin-right: 10px;">GUIDE</label>
</div>
<ul class="menu" id="menu">
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'history' %}'" {% if papka == 'history'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">И</label>стория</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block history_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'placess' %}'" {% if papka == 'places'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">М</label>еста</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block places_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'celebrity' %}'" {% if papka == 'celebrity'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">З</label>наменитости</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block celebrity_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'theaters_and_music' %}'" {% if papka == 'theaters_and_music'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">Т</label>еатры и музыка</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block theaters_and_music_dropdown %}{% endblock %}
</div>
</div>
</li>
</ul>
</div>
</div>
</nav>
<div class="popup" id="popup"><ul class="menu" id="menu">
<li style="width: 100%; justify-content: center;">
<div class="dropdown" style="width: 100%;">
<button style=" border: none; background-color: white;width: 100%;
display: flex;
justify-content: center;
padding: 20px 0;
font-size: 20px;
font-weight: bold;
color: black;
border-top: 2px solid #e2e8f0;
border-bottom: 2px solid #e2e8f0;
margin-bottom: 10px;">test dropdown menu</button>
<div class="dropdown-content" style="background-color: white;">
<a href="/history">history</a>
<a href="/places">places</a>
<a href="/celebrities">celebrities</a>
</div>
</div>
</li>
<li><a href="/history">История</a></li>
<li><a href="/places">Места</a></li>
<li><a href="/celebrities">Знаменитости</a></li>
<li><a href="/theaters">Театры и музыка</a></li>
<li style="width: 100%; justify-content: center;">
<div class="dropdown" style="width: 100%;">
<button style=" border: none; background-color: white;width: 100%;
display: flex;
justify-content: center;
padding: 20px 0;
font-size: 20px;
font-weight: bold;
color: black;
border-top: 2px solid #e2e8f0;
border-bottom: 2px solid #e2e8f0;
margin-bottom: 10px;">test dropdown menu</button>
<div class="dropdown-content">
<a href="/history">history</a>
<a href="/places">places</a>
<a href="/celebrities">celebrities</a>
</div>
</div>
</li>
</ul>
</div>
<main class="main">
<div class="container">
<div class="content">
<div class="n_bar">
{% if testthing %}
{% for object in testthing %}
{% if object.0 == 'header' %}
{% if forloop.counter == 1 %}
<a href="#hh{{ forloop.counter }}" style="word-wrap: break-word; overflow-wrap: break-word; padding-top: 10px;" class="button2">{{object.1}}</a>
{% else %}
<a href="#hh{{ forloop.counter }}" style="word-wrap: break-word; overflow-wrap: break-word;" class="button2">{{object.1}}</a>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="in_content">
<br>
<label style="font-size: 40px; width: 40px; margin-top: 20px; word-wrap: break-word;">{% if title %}{{title}}{% else %}Нету названия!{% endif %}
<hr style="max-width: auto; margin-left: 0px;"></label>
{% if testthing %}
{% for object in testthing %}
{% if object.0 == 'header' %}
<div id="hh{{ forloop.counter }}"></div>
{% if forloop.counter == 1 %}
<div>
{% else %}
<br>
<br>
<br>
{% endif %}
<label style="font-size: 40px; width: 40px; overflow-wrap: break-word;">{{object.1}}<hr style="max-width: auto; margin-left:0;"></label>
{% endif %}
{% if object.0 == 'text' %}
<br>
<br>
<pre style="max-width: 650px; word-wrap: break-word; text-align: left;font-size: 20px; white-space: pre-wrap;">{{object.1}}</pre>
{% endif %}
{% if object.0 == 'img' %}
{% for picture in object.1 %}
<img src="{% static picture %}" class="img_content" alt="imgg">
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if authtor %}
<br>
<label>{{authtor}}</label>
{% endif %}
<br>
{{date}}
<br>
<br>
<form method="post" action="{% url 'posttodb' %}">
{% csrf_token %}
<textarea style="display: none;" name="papka">{{papka}}</textarea>
<textarea style="display: none;" name="title">{{title}}</textarea>
<textarea style="display: none;" name="authtor">{{authtor}}</textarea>
<textarea style="display: none;" name="date">{{date}}</textarea>
<textarea style="display: none;" name="testthing">{{testthing}}</textarea>
<textarea style="display: none;" name="desc">{{desc}}</textarea>
<textarea style="display: none;" name="img_preview">{{img_preview}}</textarea>
<button style="width: 200px;height: 40px; border: none; ">post</button>
</form>
<br>
<br>
</div>
</div>
</main>
<script src="{% static 'first/script.js' %}"></script>
<footer class="footer">
<div class="container" style="background: #212429;">
<div class="content">
<label class="gkod_team_label">Made by <label>Gkod</label> team</label
><br />
ggkkoodd@gmail.com
<br />
<br />
<label onclick="window.location.href='/coments'"
>Форма для обратной связи
<hr style="max-width: 320px"
/></label>
</div>
</div>
</footer>
</body>
</html>

View file

@ -0,0 +1,10 @@
<form method="post" action="{% url 'editdbsite' %}">
{% csrf_token %}
<label>user</label>
<input name="userrr">
<br>
<label>password</label>
<input name="password" type="password">
<br>
<button type="submit">login</button>
</form>

View file

@ -0,0 +1,192 @@
{% load static %}
<div></div>
<!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">
<style type="text/css">
* {
font-size: 20px;
}
button {
border: none;
width: 200px;
height: 40px;
margin-top: 10px;
background: black;
color: white;
}
.btnn, .file-upload > input[type='file'] {
border: none;
height: 40px;
margin-top: 10px;
}
.file-upload {
display: inline-block;
}
.file-upload > input[type='file'] {
top: 0;
right: 0;
height: 100%;
opacity: 0;
cursor: pointer;
width: 0;
height: 0;
}
.file-upload > span {
display: inline-block;
padding: 5px 10px;
background-color: #000;
border-radius: 5px;
border: 1px solid #aaa;
color: #fff;
cursor: pointer;
}
.post-container {
width: 600px;
height: 500px;
border: 2px solid black;
border-radius: 10px;
margin: 0 auto;
display: flex;
padding: 10px;
}
.post-container > div {
width: 250px;
height: 500px;
}
.post-container label {
font-size: 16px;
}
.post-container input, .post-container textarea {
width: 100%;
height: 35px;
margin-bottom: 10px;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
.post-container textarea {
height: 200px;
}
.preview-container {
width: 600px;
border: 2px solid black;
border-radius: 10px;
margin: 20px auto 0;
padding: 10px;
}
.preview-container label {
font-size: 16px;
}
.preview-container textarea, .preview-container select, .preview-container button {
margin-top: 10px;
width: 100%;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
.preview-container select {
height: 40px;
}
.preview-container button {
height: 40px;
background: black;
color: white;
border: none;
font-size: 20px;
}
</style>
<title>make post</title>
</head>
<body>
<div>
<form method="POST" action="{% url 'postres' %}" enctype="multipart/form-data">
{% csrf_token %}
<div class="post-container">
<div>
<label for="post_name">Название статьи</label>
<input id="post_name" name="postname" value="" required>
<label for="log">log</label>
<textarea id="log"></textarea>
<label for="authtor">Автор</label>
<input id="authtor" name="authtor" value="" style="width: 160px;">
</div>
<div>
<label for="header">Заголовок (max 69)</label>
<input id="header" name="header" value="" maxlength="69">
<label for="text">Текст</label>
<textarea id="text" name="text"></textarea>
<label for="img">Картинка:</label>
<label class="file-upload">
<span>Выбрать картинку/картинки</span>
<input type="file" accept="image/jpeg, image/png" id="img" name="imgg" multiple>
</label>
<button type="button" onclick="clear_all()">Очистить</button>
<button>Добавить</button>
</div>
</div>
</form>
<form method="POST" action="{% url 'blog_preview' %}" enctype="multipart/form-data" target="_blank">
{% csrf_token %}
<textarea style="display: none" name="to_list" id="to_list">
</textarea>
<textarea style="display: none" name="postnamee" id="post_namee">
</textarea>
<textarea style="display: none" name="authtorr" id="authtorr">
</textarea>
<div class="preview-container">
<div style="display: flex; flex-direction: column; margin-right: 20px;">
<label for="desc">Описание</label>
<textarea id="desc" name="desc"></textarea>
</div>
<div style="display: flex; flex-direction: column;">
<label style="font-size: 16px;">Картинка для предпросмотра</label>
<label class="file-upload" style="margin-top: 10px;">
<span>Выбрать картинку</span>
<input type="file" accept="image/jpeg, image/png" id="imgg_preview" name="imgg_preview">
</label>
<select name="papka" required>
<option value=""> </option>
<option value="history">История</option>
<option value="places">Места</option>
<option value="celebrity">Знаменитости</option>
<option value="theaters_and_music">Театры и музыка</option>
</select>
<button type="submit">Перейти к предпросмотру</button>
</div>
</div>
</form>
</div>
<script src="{% static 'loginedtest/script.js' %}"></script>
</body>
</html>

View file

@ -0,0 +1,226 @@
<!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" />
{% block style %}{% endblock %}
<title>{% block headmain %}{% endblock %}</title>
</head>
<body>
<nav class="navbar">
<div class="container">
<div class="navbar__wrap">
<div class="hamb">
<div class="hamb__field" id="hamb">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
</div>
<div class="coltxt" onclick="window.location.href='{% url 'home' %}'">
<div
style="
width: 100%;
font-size: 30px;
align-self: center;
height: 30px;
"
class="cool_text"
>
<div id="one" style="margin-left: 10px; padding-left: 10px">
E
</div>
<div id="two"><div id="twoo">КАТЕРИНБУРГ</div></div>
<div id="three" style="color: blue">G</div>
<div id="four"><div id="fourr">UIDE</div></div>
</div>
</div>
<div class="mobile_coltxt" onclick="window.location.href='/'">
<label>EKB</label
><label
style="
color: blue;
padding-left: 0px;
margin-left: 10px;
margin-right: 10px;
"
>GUIDE</label
>
</div>
<ul class="menu" id="menu">
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'history' %}'" {% if papka == 'history'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">И</label>стория</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block history_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'placess' %}'" {% if papka == 'places'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">М</label>еста</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block places_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'celebrity' %}'" {% if papka == 'celebrity'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">З</label>наменитости</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block celebrity_dropdown %}{% endblock %}
</div>
</div>
</li>
<li>
<span class="activate_dropdown" onclick="window.location.href='{% url 'theaters_and_music' %}'" {% if papka == 'theaters_and_music'%}style="background-color: rgba(75, 75, 225); color: white;"{% endif%}><label style="color:blue">Т</label>еатры и музыка</span>
<div class="moving_dropdown">
<div class="move_me_content">
{% block theaters_and_music_dropdown %}{% endblock %}
</div>
</div>
</li>
</ul>
</div>
</div>
</nav>
<div class="popup" id="popup">
<ul class="menu" id="menu">
<li style="width: 100%; justify-content: center">
<div class="dropdown" style="width: 100%">
<button
style="
border: none;
background-color: white;
width: 100%;
display: flex;
justify-content: center;
padding: 20px 0;
font-size: 20px;
font-weight: bold;
color: black;
border-top: 2px solid #e2e8f0;
border-bottom: 2px solid #e2e8f0;
margin-bottom: 10px;
"
>
test dropdown menu
</button>
<div class="dropdown-content" style="background-color: white">
<a href="/history">history</a>
<a href="/places">places</a>
<a href="/celebrities">celebrities</a>
</div>
</div>
</li>
<li><a href="/history">История</a></li>
<li><a href="/places">Места</a></li>
<li><a href="/celebrities">Знаменитости</a></li>
<li><a href="/theaters">Театры и музыка</a></li>
<li style="width: 100%; justify-content: center">
<div class="dropdown" style="width: 100%">
<button
style="
border: none;
background-color: white;
width: 100%;
display: flex;
justify-content: center;
padding: 20px 0;
font-size: 20px;
font-weight: bold;
color: black;
border-top: 2px solid #e2e8f0;
border-bottom: 2px solid #e2e8f0;
margin-bottom: 10px;
"
>
test dropdown menu
</button>
<div class="dropdown-content">
<a href="/history">history</a>
<a href="/places">places</a>
<a href="/celebrities">celebrities</a>
</div>
</div>
</li>
</ul>
</div>
<main class="main">
<div class="container">
<div class="content">
{% block maincontent %}{% endblock %}
</div>
</div>
</main>
<footer class="footer" style="">
<div class="container" style="background: #212429;">
<div class="content" style="
">
<div class="fo1" style="
">
<label>Основные разделы</label>
<br>
<label onclick="window.location.href='/history/'" style="
cursor: pointer;
">История</label>
<label onclick="window.location.href='/places/'" style="
cursor: pointer;
">Места</label>
<label onclick="window.location.href='/celebrity/'" style="
cursor: pointer;
">Знаменитости</label>
<label onclick="window.location.href='/theaters_and_music/'" style="
cursor: pointer;
">Театры и музыка</label>
</div>
<div class="fo2">
<label class="gkod_team_label" style="
height: 50px;
width: 300px;
">Made by Gkod team</label><label onclick="window.location.href='mailto:gkod@gkod.fun'" style="
cursor: pointer;
">gkod@gkod.fun</label>
</div>
<div style="display: flex;justify-content: center;align-items: center;flex-direction: column;margin-top: 30px;">
<label onclick="window.location.href='/coments'" style="
cursor: pointer;
">Форма для обратной связи
<hr style="max-width: 320px"></label>
<div style="
margin-top: 20px;
">
<img onclick="window.location.href='https://vk.com/okhlupin_k'" src="/static/tmp/sl286z9378p2687u5srp20230425131051.png"
style="height: 70px; cursor: pointer;" alt="vkicon"/>
<img onclick="window.location.href='https://t.me/koka_c17'" src="/static/tmp/q109d033r5q04i8734rl520230425155022.png"
style="height: 70px; cursor: pointer;" alt="tgicon"/></div>
</div>
</div>
</div>
</footer>
{% block js %}{% endblock %}
</body>
</html>

View file

@ -0,0 +1,109 @@
{% extends "preview_api/base.html" %}
{% load static %}
{% block headmain %}EKB{% endblock %}
{% block style%}
<link rel="stylesheet" href="{% static 'loginedtest/style.css' %}">
<link rel="stylesheet" href="{% static 'first/style.css' %}" />
{% endblock %}
{% block history_dropdown %}
{% if random_history %}
{% for ran in random_history %}
<a href="/{{ran.papka}}/?type={{ran.papka}}&title={{ran.title}}">{{ran.title}}</a>
{% endfor %}
{% else %}
<a href="">ошибка....</a>
{% endif %}
{% endblock %}
{% block places_dropdown %}
{% if random_places %}
{% for ran in random_places %}
<a href="/{{ran.papka}}/?type={{ran.papka}}&title={{ran.title}}">{{ran.title}}</a>
{% endfor %}
{% else %}
<a href="">ошибка....</a>
{% endif %}
{% endblock %}
{% block celebrity_dropdown %}
{% if random_celebrity %}
{% for ran in random_celebrity %}
<a href="/{{ran.papka}}/?type={{ran.papka}}&title={{ran.title}}">{{ran.title}}</a>
{% endfor %}
{% else %}
<a href="">ошибка....</a>
{% endif %}
{% endblock %}
{% block theaters_and_music_dropdown %}
{% if random_theaters_and_music %}
{% for ran in random_theaters_and_music %}
<a href="/{{ran.papka}}/?type={{ran.papka}}&title={{ran.title}}">{{ran.title}}</a>
{% endfor %}
{% else %}
<a href="">ошибка....</a>
{% endif %}
{% endblock %}
{% block maincontent %}
<div class="n_bar">
<a href="#hh{{ forloop.counter }}" style="word-wrap: break-word; overflow-wrap: break-word; padding-top: 10px;" class="button2">{{title}}</a>
</div>
<div class="in_content" style="padding-top: 25px;">
<label style="font-size: 40px; width: 40px;">{{namee}}<hr style="max-width: 400px; margin-left:0;"></label>
<label style="font-size: 30px; margin-top: 20px;">{{title}}<hr style="max-width: 90px; margin-left:0;"></label>
<label style="font-size: 20px; ">{{desc}}</label>
<br>
<!-- <img src="{% static 'places/img/p1.jpg' %}" class="img_content"> -->
{% if img_preview %}
<img src="{% static img_preview %}" class="img_content">
{% endif %}
<button class="more_butt">Подробнее</button>
<br>
<br>
<form method="post" action="{% url 'blog_preview2' %}">
{% csrf_token %}
<textarea style="display: none;" name="papka">{{papka}}</textarea>
<textarea style="display: none;" name="title">{{title}}</textarea>
<textarea style="display: none;" name="authtor">{{authtor}}</textarea>
<textarea style="display: none;" name="testthing">{{testthing}}</textarea>
<textarea style="display: none;" name="desc">{{desc}}</textarea>
<textarea style="display: none;" name="img_preview">{{img_preview}}</textarea>
<button style="width: 200px;height: 40px; border: none; ">Далее</button>
</form>
<br>
<br>
{% endblock %}
{% block js %}<script src="{% static 'first/script.js' %}"></script>{% endblock %}

3
adminsystemdb/tests.py Executable file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

15
adminsystemdb/ttmp.py Executable file
View file

@ -0,0 +1,15 @@
import random
def main():
n = 20
al = "abcdefghigklmnopqrstuvwxyz"
thing = ""
for i in range(0, 16):
a = random.randint(0, 1)
if a == 0:
thing += al[random.randint(0, len(al))]
else:
thing += str(random.randint(0, 10))
print(thing)
input()

12
adminsystemdb/urls.py Executable file
View file

@ -0,0 +1,12 @@
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.index),
path('edit/', views.inacound, name='editdbsite'),
path('edit/get_res', views.get_data, name='postres'),
path('edit/getlist', views.clear_blog, name='clear_blog'),
path('edit/preview', views.blog_preview, name='blog_preview'),
path('edit/preview2', views.blog_preview2, name='blog_preview2'),
path("edit/postt", views.post_to_db, name='posttodb')
]

205
adminsystemdb/views.py Executable file
View file

@ -0,0 +1,205 @@
from django.shortcuts import render, redirect, HttpResponse
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.conf import settings
from .models import Poseters
from datetime import datetime
import random
import json
import ast
import os
# Create your views here.
def index(req):
# return redirect('dbloginadmin/index.html')
return render(req, 'dbloginadmin/index.html')
def inacound(req):
if req.method == 'POST':
if req.POST.get('userrr') == '1w05h7py180p4h10g' and req.POST.get('password') == 'fos2g5i47tt90n1p':
return render(req, 'loginedtest/index.html')
else:
return redirect('/adminsystemdb')
else:
return redirect('/adminsystemdb')
def get_random():
n = 20
al = "abcdefghigklmnopqrstuvwxyz"
thing = ""
for i in range(0, n):
a = random.randint(0, 1)
if a == 0:
thing += al[random.randint(0, len(al)-1)]
else:
thing += str(random.randint(0, 10))
return thing
def get_data(req):
try:
if not req.POST['csrfmiddlewaretoken']:
return HttpResponse('fuk yo')
except Exception:
return HttpResponse('')
text_res = ""
list_res = []
if req.POST['header']:
text_res += f"\nзагаловок: {req.POST['header']}\n"
list_res.append(['header', f"{req.POST['header']}"])
if req.POST['text']:
text_res += f"\nтекст: {req.POST['text']}\nзтекст\n"
list_res.append(['text', f"{req.POST['text']}"])
if req.FILES.getlist('imgg'):
imgs_names = []
for i in req.FILES.getlist('imgg'):
fo = ""
for j in i.name[::-1]:
if j == ".":
fo += j
break
fo += j
nn = get_random() + f"{datetime.now()}".replace("-", "").replace(" ", "").replace(":", "").replace(".", "")[:-6] + fo[::-1]
nn = nn.replace(" ", "_")
path = default_storage.save(f"tmp/{nn}", ContentFile(i.read()))
tmp_file = os.path.join(settings.MEDIA_ROOT, path)
os.replace(tmp_file, tmp_file[:-len(nn)-10]+f'static/tmp/{nn}')
imgs_names.append(nn)
text_res += f"картинка: {imgs_names}"
list_res.append(['img', ['tmp/'+ i for i in imgs_names] ])
if len(f"{list_res}") == 2:
data = json.dumps(
{'text':text_res,
'list_preview':'',
'postname': req.POST["postname"],
'authtor': req.POST["authtor"]
}
)
else:
data = json.dumps(
{'text':text_res,
'list_preview':f"{list_res}"[1:-1]+',',
'postname': req.POST["postname"],
'authtor': req.POST["authtor"]
}
)
return HttpResponse(data)
def clear_blog(req):
res = ast.literal_eval(req.POST['tolist'])
return HttpResponse(f"{res}")
global text_imgs
global res_text_render
global post_name
global authtor
global new_res_text_render
new_res_text_render = []
text_imgs = []
res_text_render = ""
post_name = ""
authtor = ""
return render(req, 'loginedtest/index.html')
def blog_preview(req):
if Poseters.objects.filter(title=req.POST['postnamee']).values():
return HttpResponse("Статья с таким названием уже существует!")
try:
res = ast.literal_eval(req.POST['to_list'])
except Exception:
res = ''
if req.FILES.getlist('imgg_preview'):
i = req.FILES.getlist('imgg_preview')[0]
fo = ""
for j in i.name[::-1]:
if j == ".":
fo += j
break
fo += j
nn = get_random() + f"{datetime.now()}".replace("-", "").replace(" ", "").replace(":", "").replace(".", "")[:-6] + fo[::-1]
nn = nn.replace(" ", "_")
path = default_storage.save(f"tmp/{nn}", ContentFile(i.read()))
tmp_file = os.path.join(settings.MEDIA_ROOT, path)
os.replace(tmp_file, tmp_file[:-len(nn)-10]+f'static/tmp/{nn}')
# path = default_storage.save(f"tmp/{i.name}", ContentFile(i.read()))
# tmp_file = os.path.join(settings.MEDIA_ROOT, path)
# name = ""
# for j in tmp_file[::-1]:
# if j == '/':
# break
# name += j
# name = name[::-1]
# os.replace(tmp_file, tmp_file[:-len(name)-10]+f'adminsystemdb/static/tmp/{name}')
img_preview = 'tmp/' + nn
else:
img_preview = ''
return render(req, "preview_api/index.html", {"namee":"preview",
"title":req.POST['postnamee'],
"testthing":res,
"authtor":req.POST["authtorr"],
"papka":req.POST["papka"],
"desc":req.POST["desc"],
"img_preview": img_preview,
})
def blog_preview2(req):
try:
res = ast.literal_eval(req.POST['testthing'])
except Exception:
res = ''
return render(req, 'blog_preview/index.html',{'title':req.POST['title'],
"testthing":res,
"authtor":req.POST["authtor"],
"date":f" {datetime.today()}"[:-10],
"papka":req.POST["papka"],
"desc":req.POST["desc"],
"img_preview": req.POST['img_preview']
})
def post_to_db(req):
src = req.POST
papka = src["papka"]
title = src["title"]
authtor = src["authtor"]
date = src["date"]
testthing = src["testthing"]
desc = src["desc"]
img_preview = src["img_preview"]
Poseters.objects.create(papka=papka, title=title, authror=authtor, date=date, content=testthing, desc=desc, img_preview=img_preview)
return redirect(f"/{papka}?type={papka}&title={title}")