daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def delete_comment(id):
  2.     comment = Comment.query.get_or_404(id)
  3.     post = Post.query.get_or_404(comment.post_id)
  4.     if comment.user != current_user and post.author != current_user:
  5.         abort(403)
  6.     db.session.delete(comment)
  7.     db.session.commit()
  8.     flash('The comment has been deleted!', 'success')
  9.  
  10.     return redirect(url_for('main.home'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top