Answer the question
In order to leave comments, you need to log in
How to check user action?
Good evening. I have a small blog written in Python / Flask. I want to implement a post approval system.
Adding likes done, now a bit confused with checking for likes/dislikes by a user of a certain comment. If you already like it, then you can't do it anymore. I am attaching the database structure.
What can you advise?
-Users
--id
--name
--email
--password
-Posts
--id
--title
--description
--author_id
-Comments
--id
--text
--author_name
--post_id
--like
Answer the question
In order to leave comments, you need to log in
Obviously, if you want to store a user's like for a comment, then there must be a `likes` table with the fields `user_id` and `comment_id` together forming the primary key.
In this case, it will simply not be possible to add two likes of one user to one comment in the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question