ОТКАТ КОММИТА
This commit is contained in:
parent
32a9bfaac8
commit
5a82a47532
BIN
db/moona_data.db
BIN
db/moona_data.db
Binary file not shown.
9
main.py
9
main.py
@ -100,10 +100,12 @@ def main_page():
|
||||
if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first():
|
||||
emotion['is_like'] = 1
|
||||
emotion_for_you.append(emotion)
|
||||
if current_user.is_authenticated:
|
||||
you_like_that = sorted(list(map(lambda x: session.query(DiaryPost).filter(DiaryPost.id == x).first(),
|
||||
map(lambda x: x.post,
|
||||
session.query(Like).filter(Like.user == current_user.id).all()))),
|
||||
key=lambda x: (len(x.text), 1 if x.photo else 0, -(x.date - datetime.datetime.now()).days))
|
||||
key=lambda x: (
|
||||
len(x.text), 1 if x.photo else 0, -(x.date - datetime.datetime.now()).days))
|
||||
emotion_you_like_that = []
|
||||
for i in you_like_that:
|
||||
emotion = {id: i.id, 'pos_emot': [], 'nig_emot': [], 'link': [],
|
||||
@ -149,6 +151,11 @@ def main_page():
|
||||
ans2 = {}
|
||||
for i in ans:
|
||||
ans2[i.id_question] = i
|
||||
else:
|
||||
you_like_that = []
|
||||
emotion_you_like_that = None
|
||||
post_quest = None
|
||||
ans2 = None
|
||||
return render_template('main.html', title='moona', for_me_post=for_you_post, emotion_for_you=emotion_for_you,
|
||||
you_like_that=you_like_that, emotion_you_like_that=emotion_you_like_that,
|
||||
question=post_quest,
|
||||
|
||||
@ -26,9 +26,8 @@ summary {
|
||||
.my_author {
|
||||
width:40%;
|
||||
height:5%;
|
||||
left:10%;
|
||||
-webkit-border-radius: 22px;
|
||||
-moz-border-radius: 22px;
|
||||
margin-left:30%;
|
||||
margin-right:30%;
|
||||
border-radius: 22px;
|
||||
border:2px solid #ffffff;
|
||||
background-color:#1daff0;
|
||||
@ -43,12 +42,11 @@ summary {
|
||||
.card-body {
|
||||
background-color: #7fc3ff;
|
||||
}
|
||||
#all_my_post, #all_my_post1 {
|
||||
.all_my_post {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
#my_post, #my_post1 {
|
||||
text-align: center;
|
||||
.card {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
background-color: #7fc3ff;
|
||||
@ -56,15 +54,14 @@ summary {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.my_author, .my_post_zag {
|
||||
margin-left: 50%;
|
||||
margin-right: auto;
|
||||
margin-top: -20%;
|
||||
text-align: center;
|
||||
}
|
||||
.pub, .private {
|
||||
width: 60%;
|
||||
width: 55%;
|
||||
height: 10%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-left:25%;
|
||||
margin-right: 25%;
|
||||
text-align: center;
|
||||
}
|
||||
#add_post {
|
||||
margin-top: 20px;
|
||||
@ -72,6 +69,9 @@ summary {
|
||||
}
|
||||
#edit_btn, #edit_btn1 {
|
||||
background-color: #c5f1ff;
|
||||
margin-left: 10%;
|
||||
margin-right: auto;
|
||||
margin-top: 15px;
|
||||
}
|
||||
input[type=text], input[type=email], input[type=password], input[type=file], input[type=number]{
|
||||
padding:10px;
|
||||
@ -98,7 +98,7 @@ textarea {
|
||||
margin-left: 20px;
|
||||
}
|
||||
#row2, #row1 {
|
||||
width: 30%;
|
||||
width: 32%;
|
||||
}
|
||||
#row1, #row2, #all_my_question {
|
||||
display:inline-block;
|
||||
@ -114,9 +114,8 @@ textarea {
|
||||
}
|
||||
.question, .my_post {
|
||||
background-color:#7fc3ff;
|
||||
border-radius: 22px;
|
||||
width: 100%;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.is_ans {
|
||||
background-color:#ddefff;
|
||||
@ -138,7 +137,7 @@ table {
|
||||
margin-right: auto;
|
||||
}
|
||||
#row1_div, #row2_div {
|
||||
width: 98%;
|
||||
width: 98%;
|
||||
}
|
||||
td {
|
||||
margin: 20px;
|
||||
@ -149,3 +148,7 @@ width: 25%;
|
||||
.is_ans {
|
||||
width: 95%;
|
||||
}
|
||||
.card-text {
|
||||
color:#ffffff;
|
||||
text-align: center;
|
||||
}
|
||||
@ -19,11 +19,10 @@
|
||||
<td id="row1">
|
||||
<div id="row1_div">
|
||||
<h2 class="my_post_zag" style="margin-bottom: 10%; margin-left:15%">Публикации</h2>
|
||||
<div id="all_my_post1">
|
||||
<div class="all_my_post">
|
||||
{% if my_post != [] %}
|
||||
{% for item in pub_post %}
|
||||
|
||||
<div class="card" style="width: 25rem;">
|
||||
<div class="card">
|
||||
{% if item.photo != None %}
|
||||
<img src="{{ item.photo }}" class="card-img-top" alt="...">
|
||||
{% endif %}
|
||||
@ -37,20 +36,20 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
{% if emotion_pub[loop.index0]['pos_emot'] != None %}
|
||||
<li class="list-group-item">
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%;">
|
||||
{% for item2 in emotion[loop.index0]['pos_emot'] %}
|
||||
{% for item2 in emotion_pub[loop.index0]['pos_emot'] %}
|
||||
<li>
|
||||
<div class="emot"><strong class="alert alert-success" role="alert"
|
||||
style="border-radius: 22px;">{{item2}}</strong></div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
{% endif %}
|
||||
{% if emotion_pub[loop.index0]['nig_emot'] != None %}
|
||||
<li class="list-group-item">
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%">
|
||||
{% for item2 in emotion_pub[loop.index0]['nig_emot'] %}
|
||||
<li>
|
||||
@ -59,28 +58,31 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
{% endif %}
|
||||
{% if emotion_pub[loop.index0]['link'] != None %}
|
||||
<li class="list-group-item">
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%; margin-bottom:5%">
|
||||
{% for item2 in emotion_pub[loop.index0]['link'] %}
|
||||
<li>
|
||||
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}" style="border-radius: 22px;">Ссылка
|
||||
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}"
|
||||
style="border-radius: 22px;">Ссылка
|
||||
{{ loop.index }}</a></div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="card-body">
|
||||
{% if item.public == 1 or item.public == 'True' %}
|
||||
<div style="border-radius: 22px; margin-left:-5%; width: 50%" class="alert alert-success pub" role="alert">Запись
|
||||
<div style="border-radius: 22px;" class="alert alert-success pub"
|
||||
role="alert">Запись
|
||||
опубликована
|
||||
</div>
|
||||
{% else %}
|
||||
<div style="border-radius: 22px; margin-left:-5% width: 50%" class="alert alert-danger private" role="alert">Запись
|
||||
<div style="border-radius: 22px;" class="alert alert-danger private"
|
||||
role="alert">Запись
|
||||
приватная
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -101,15 +103,18 @@
|
||||
<p style="color:#ffffff; margin-left:30%">{{emotion_pub[loop.index0]['like']}}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn">
|
||||
<div class="edit">
|
||||
<a style="border-radius: 15px;" href="/post/{{ item.id }}"
|
||||
class="btn" id="edit_btn">
|
||||
Изменить
|
||||
</a>
|
||||
<a style="border-radius: 15px; margin-top:10%" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
|
||||
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}"
|
||||
class="btn btn-danger">
|
||||
Удалить
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="bad_centre" style="background-color:#1daff0; border-radius: 22px;color:#ffffff">
|
||||
@ -121,11 +126,11 @@
|
||||
</td>
|
||||
<td id="row2">
|
||||
<div id="row2_div">
|
||||
<h2 class="my_post_zag" style="margin-bottom: 10%; margin-left:15%">Мои мысли</h2>
|
||||
<div id="all_my_post">
|
||||
<h2 class="my_post_zag">Мои мысли</h2>
|
||||
<div class="all_my_post">
|
||||
{% if my_post != [] %}
|
||||
{% for item in my_post %}
|
||||
<div class="card" style="width: 25rem;">
|
||||
<div class="card">
|
||||
{% if item.photo != None %}
|
||||
<img src="{{ item.photo }}" class="card-img-top" alt="...">
|
||||
{% endif %}
|
||||
@ -139,8 +144,8 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
{% if emotion[loop.index0]['pos_emot'] != None %}
|
||||
<li class="list-group-item">
|
||||
{% if emotion_pub[loop.index0]['pos_emot'] != None %}
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%;">
|
||||
{% for item2 in emotion[loop.index0]['pos_emot'] %}
|
||||
<li>
|
||||
@ -149,40 +154,43 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if emotion[loop.index0]['nig_emot'] != None %}
|
||||
<li class="list-group-item">
|
||||
{% if emotion_pub[loop.index0]['nig_emot'] != None %}
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%">
|
||||
{% for item2 in emotion_pub[loop.index0]['nig_emot'] %}
|
||||
{% for item2 in emotion[loop.index0]['nig_emot'] %}
|
||||
<li>
|
||||
<div class="emot"><strong class="alert alert-danger" role="alert"
|
||||
style="border-radius: 22px;">{{item2}}</strong></div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if emotion[loop.index0]['link'] != None %}
|
||||
<li class="list-group-item">
|
||||
{% if emotion_pub[loop.index0]['link'] != None %}
|
||||
<ul style="list-style-type: none; margin-left:-15%; margin-top:5%; margin-bottom:5%">
|
||||
{% for item2 in emotion_pub[loop.index0]['link'] %}
|
||||
{% for item2 in emotion[loop.index0]['link'] %}
|
||||
<li>
|
||||
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}" style="border-radius: 22px;">Ссылка
|
||||
<div class="emot"><a class="alert alert-light" role="alert" href="{{ item2 }}"
|
||||
style="border-radius: 22px;">Ссылка
|
||||
{{ loop.index }}</a></div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="card-body">
|
||||
{% if item.public == 1 or item.public == 'True' %}
|
||||
<div style="border-radius: 22px; margin-left:-5%; width: 50%" class="alert alert-success pub" role="alert">Запись
|
||||
<div style="border-radius: 22px;" class="alert alert-success pub"
|
||||
role="alert">Запись
|
||||
опубликована
|
||||
</div>
|
||||
{% else %}
|
||||
<div style="border-radius: 22px; margin-left:-5% width: 50%" class="alert alert-danger private" role="alert">Запись
|
||||
<div style="border-radius: 22px;" class="alert alert-danger private"
|
||||
role="alert">Запись
|
||||
приватная
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -191,14 +199,17 @@
|
||||
<strong style="color: #ffffff">{{ current_user.name }}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn">
|
||||
<a style="border-radius: 15px;" href="/post/{{ item.id }}"
|
||||
class="btn" id="edit_btn1">
|
||||
Изменить
|
||||
</a>
|
||||
<a style="border-radius: 15px; margin-top:10%" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
|
||||
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}"
|
||||
class="btn btn-danger">
|
||||
Удалить
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="bad_centre" style="background-color:#1daff0; border-radius: 22px;color:#ffffff">
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
<table id="main_table">
|
||||
<td class="row1">
|
||||
<div class="rowdiv1">
|
||||
{% if current_user.is_authenticated %}
|
||||
<h2 class="my_post_zag" style="margin-left:15%">Вопросы дня</h2>
|
||||
<div class="my_post">
|
||||
<div class="question">
|
||||
@ -38,6 +39,9 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>Чтобы увидеть вопросы дня войдите в аккаунт</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td class="row2">
|
||||
@ -225,7 +229,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn">
|
||||
<a style="border-radius: 15px; margin-top:10%; margin-left:1%" href="/post/{{ item.id }}" class="btn" id="edit_btn1">
|
||||
Изменить
|
||||
</a>
|
||||
<a style="border-radius: 15px; margin-top:10%" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user