Исправлены ошибки в лайках
This commit is contained in:
parent
7bd4121354
commit
0d4d3b61ee
BIN
db/moona_data.db
BIN
db/moona_data.db
Binary file not shown.
5
main.py
5
main.py
@ -112,8 +112,9 @@ def publications():
|
|||||||
like = session.query(Like).filter(Like.post == i.id).all()
|
like = session.query(Like).filter(Like.post == i.id).all()
|
||||||
if like:
|
if like:
|
||||||
emotion['like'] = len(like)
|
emotion['like'] = len(like)
|
||||||
if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first():
|
if current_user.is_authenticated:
|
||||||
emotion['is_like'] = 1
|
if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first():
|
||||||
|
emotion['is_like'] = 1
|
||||||
emotion_fresh.append(emotion)
|
emotion_fresh.append(emotion)
|
||||||
return render_template('publications.html', fresh_post=fresh_posts, emotion_fresh=emotion_fresh, title='moona')
|
return render_template('publications.html', fresh_post=fresh_posts, emotion_fresh=emotion_fresh, title='moona')
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<p></p>
|
<p></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if current_user.is_authenticated %}
|
||||||
<div class="like">
|
<div class="like">
|
||||||
<a type="button"
|
<a type="button"
|
||||||
href="/new_like/{{current_user.id}}/{{item.id}}/publications">
|
href="/new_like/{{current_user.id}}/{{item.id}}/publications">
|
||||||
@ -69,6 +70,7 @@
|
|||||||
<p style="color:#ffffff">{{emotion_fresh[loop.index0]['like']}}</p>
|
<p style="color:#ffffff">{{emotion_fresh[loop.index0]['like']}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if emotion_fresh[loop.index0]['link'] != None %}
|
{% if emotion_fresh[loop.index0]['link'] != None %}
|
||||||
<details>
|
<details>
|
||||||
<summary class="emot_block">
|
<summary class="emot_block">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user