def delete(comment_id):
the_comment = Comment.query.get_or_404(comment_id)
if current_user.id == the_comment.user_id or current_user.can(Permission.DELETE_OTHERS_COMMENT):
the_comment.deleted = 1
book_id = the_comment.book_id
db.session.add(the_comment)
db.session.commit()
flash(u'????????.', 'info')
return redirect(request.args.get('next') or url_for('book.detail', book_id=book_id))
else:
abort(403)
评论列表
文章目录