def unlike(post_id): current_user.unlike(Post.query.get(post_id)) current_user.update_stats() Post.query.get(post_id).author.update_stats() db.session.commit() flash("post unliked!") return redirect(url_for('index'))
def unlike_chirp(handle, post_id): post = Post.query.get(post_id) current_user.unlike(post) db.session.commit() return redirect(url_for('main.home'))
def unlike(post_id): the_post = Post.query.filter_by(id=post_id).first() if the_post is None: flash('Post {} not found.'.format(post_id)) return redirect(url_for('main.index')) current_user.unlike(the_post) db.session.commit() flash('You unliked the post!') return redirect(request.referrer or url_for('main.show_post', id=post_id))
def like_action(post_id, action): post = Post.query.filter_by(id=post_id).first_or_404() if action == 'like': current_user.like(post) db.session.commit() if action == 'unlike': current_user.unlike(post) db.session.commit() return redirect(request.referrer)
def comment_like(comment_id, action): comment = Comment.query.filter_by(id=comment_id).first_or_404() if action == 'like': current_user.like('comment', comment) db.session.commit() if action == 'unlike': current_user.unlike('comment', comment) db.session.commit() return redirect(request.referrer)
def unlike_answer(id): answer = Answer.query.get_or_404(id) if answer.is_liked_by(current_user): current_user.unlike(answer) answer_cancel_vote.send(answer) flash('取消赞') return redirect(url_for('.question', id=answer.question_id)) flash('还没赞呢') return redirect(url_for('.question', id=answer.question_id))
def unlike(video_id): video = Video.query.filter_by(id=video_id).first_or_404() if video is None: flash('Video {} not found'.format(video.title)) return redirect(url_for('index')) current_user.unlike(video) db.session.commit() flash('{} removed from your liked videos'.format(video.title)) return redirect(url_for('watch', video_id=video.id))
def react(post_id): post = Post.query.filter_by(id=post_id).first() if current_user.is_liking(post): current_user.unlike(post) db.session.commit() return jsonify(count=post.likers.count(), reaction_type=0) current_user.like(post) db.session.commit() return jsonify(count=post.likers.count(), reaction_type=1)
def unlike(post_id): post = Post.query.filter_by(id=post_id).first() if post is None: flash('Post {} not found.'.format(post_id)) return redirect(url_for('index')) current_user.unlike(post) db.session.commit() flash("You unliked {}'s post.".format(post.author.username)) return redirect(request.referrer)
def unlike(): pid = request.form.get("post_id") post = Post.query.filter_by(id=pid).first() if post is None: flash("Post not found") return redirect(url_for('index')) current_user.unlike(post) db.session.commit() return jsonify(result=(str(post.liked.count()) + " Like"))
def unlike_comment(id): comment = Comment.query.get_or_404(id) if comment.is_liked_by(current_user): current_user.unlike(comment) comment_cancel_vote.send(comment) flash('取消赞') return choose_to_redirect(comment.topic_type, comment) flash('还没赞呢') return choose_to_redirect(comment.topic_type, comment)
def like_action(song_id, action): song = Songs.query.filter_by(id=song_id).first_or_404() if action == "like": current_user.like(song) db.session.commit() if action == "unlike": current_user.unlike(song) db.session.commit() return redirect(request.referrer)
def unlike_post(id): post = Post.query.get_or_404(id) if post.is_liked_by(current_user): current_user.unlike(post) post_cancel_vote.send(post) flash('取消赞') return redirect(url_for('.post', id=post.id)) flash('还没赞呢') return redirect(url_for('.post', id=post.id))
def unlike(post_id): post = Post.query.filter_by(id=post_id).first_or_404() current_user.unlike(post) db.session.commit() flash("You have have unliked the post") return redirect(f"/post/{post.id}") return render_template("post.html", unlike=unlike, post=post, form=form, user=user)
def likePost(postId, action): postNum = request.args.get('posts', postId) post = Post.query.filter_by(postId=postNum).first() if action == 'like': User.like(current_user, post) db.session.commit() return redirect(request.referrer) if action == 'unlike': current_user.unlike(post) db.session.commit() return redirect(request.referrer)
def unlikesomeone(wrdsbusername): db = database.get_db() with db.cursor() as cur: try: userid, name = get_credentials_from_wrdsbusername( wrdsbusername, cur) except TypeError: return render_template( "error.html", text="Sorry, we couldn't find any record of " + str(wrdsbusername) + " in our database.", ) current_user.unlike(userid) return redirect("/users/viewprofile/" + wrdsbusername, 302)
def video_unlike(id): video = Video.query.get_or_404(id) ip = request.remote_addr if current_user.unlike(ip, video): return 'True:' + str(video.likers.count()) else: return 'False:' + str(video.likers.count())
def like_action(id, action): ref = request.args.get('ref') form = New_comment() post=Posts.query.filter_by(id=id).first() for i in post.likes: # print('==============',i.user_id) user_likes = Users.query.filter_by(id=i.user_id).all() for i in user_likes: print('=======', i.username) # p.likes.count() if action == 'like': current_user.like(post) db.session.commit() if ref == "profile": return redirect(url_for("profile")) elif ref == 'posts': return redirect(url_for("posts")) else: redirect(url_for('profile')) if action == 'flag': current_user.flag(post) db.session.commit() if ref == "profile": return redirect(url_for("profile")) elif ref == 'posts': return redirect(url_for("posts")) else: redirect(url_for('profile')) if action == 'unlike': current_user.unlike(post) db.session.commit() if ref == "profile": return redirect(url_for("profile")) elif ref == 'posts': return redirect(url_for("posts")) else: redirect(url_for('profile')) if action == 'unflag': current_user.unflag(post) db.session.commit() if ref == "profile": return redirect(url_for("profile")) elif ref == 'posts': return redirect(url_for("posts")) else: redirect(url_for('profile')) return render_template('single_post.html', post=post, form=form)
def unlike(id): current_user.unlike(id) return redirect(url_for('posts', id=id))
def unlike(id): post = Post.query.get_or_404(id) current_user.unlike(post) db.session.commit() response = jsonify({'result': current_user.username}) return response, 201
def unlike(event_id): if current_user.is_authenticated(): current_user.unlike(event_id) db.session.commit()