From 0d4d3b61ee850c00b2e6d8baac9a23dab9ac6251 Mon Sep 17 00:00:00 2001 From: mrmur Date: Thu, 14 Apr 2022 17:04:56 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D0=BB=D0=B0=D0=B9=D0=BA=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/moona_data.db | Bin 73728 -> 73728 bytes main.py | 5 +++-- templates/publications.html | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/db/moona_data.db b/db/moona_data.db index 5c549ad81225f955a48f649ba91f243b6f94e7c5..d7fb9ae47147a1ed44a30efab433302ea14133cb 100644 GIT binary patch delta 75 zcmV-R0JQ&rzyyH61dtm6tC1W-0jsfKq+bXC5C8xV-VeO95g@Y h1u`%)GA%GPEip78F*Q0gH###lE-^7SG%z@#aIkvU6)*q* diff --git a/main.py b/main.py index 0deba8c..d63ded5 100644 --- a/main.py +++ b/main.py @@ -112,8 +112,9 @@ def publications(): like = session.query(Like).filter(Like.post == i.id).all() if like: emotion['like'] = len(like) - if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first(): - emotion['is_like'] = 1 + if current_user.is_authenticated: + if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first(): + emotion['is_like'] = 1 emotion_fresh.append(emotion) return render_template('publications.html', fresh_post=fresh_posts, emotion_fresh=emotion_fresh, title='moona') diff --git a/templates/publications.html b/templates/publications.html index b117862..eacb562 100644 --- a/templates/publications.html +++ b/templates/publications.html @@ -56,6 +56,7 @@

{% endif %} + {% if current_user.is_authenticated %} + {% endif %} {% if emotion_fresh[loop.index0]['link'] != None %}