Answer the question
In order to leave comments, you need to log in
How to make the right selection from the database?
I like blog comments.
Googled this solution.
But it works, only for the first comment. Yes, yes, I'm aware that it says .first()
I don't know how to select exactly the comment next to which the button is pressed.
What do you think?
if request.method == 'POST':
like = Commentary.query.filter_by(key=post_id).first()
like.like += 1
db.session.commit()
<form method='POST'>
<input type='submit' value="+1" class="btn btn-primary">
</form>
Answer the question
In order to leave comments, you need to log in
Не знаю, как выбрать именно тот, комментарий, возле которого нажата кнопка
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question