Beispiel #1
0
def delete_review(review_id):
    """删除作品点评"""
    review = WorkReview.query.get_or_404(review_id)
    permission = WorkReviewAdminPermission(review_id)
    if not permission.check():
        return permission.deny()
    db.session.delete(review)
    db.session.commit()
    return redirect(url_for('.view', work_id=review.work_id))
Beispiel #2
0
def delete_review(review_id):
    """删除作品点评"""
    review = WorkReview.query.get_or_404(review_id)
    permission = WorkReviewAdminPermission(review_id)
    if not permission.check():
        return permission.deny()
    db.session.delete(review)
    db.session.commit()
    return redirect(url_for('.view', work_id=review.work_id))
Beispiel #3
0
def edit_review(review_id):
    """编辑作品点评"""
    review = WorkReview.query.get_or_404(review_id)
    permission = WorkReviewAdminPermission(review_id)
    if not permission.check():
        return permission.deny()
    form = WorkReviewForm(obj=review)
    if form.validate_on_submit():
        form.populate_obj(review)
        review.is_publish = True if 'publish' in request.form else False
        db.session.add(review)
        db.session.commit()
        return redirect(url_for('.review', review_id=review_id))
    return render_template('work/edit_review/edit_review.html', review=review, form=form)
Beispiel #4
0
def edit_review(review_id):
    """编辑作品点评"""
    review = WorkReview.query.get_or_404(review_id)
    permission = WorkReviewAdminPermission(review_id)
    if not permission.check():
        return permission.deny()
    form = WorkReviewForm(obj=review)
    if form.validate_on_submit():
        form.populate_obj(review)
        review.is_publish = True if 'publish' in request.form else False
        db.session.add(review)
        db.session.commit()
        return redirect(url_for('.review', review_id=review_id))
    return render_template('work/edit_review/edit_review.html', review=review, form=form)