def dashboard_review_new(): if current_user.is_admin: form = forms.new_review() if form.validate_on_submit(): models.Review.add_review(user=form.user.data, order_id=form.order_id.data, text=form.text.data) return redirect(url_for('add_review_dashboard')) return render_template("dashboard/html/product/new.html", user=current_user, form=form) else: return redirect(url_for('index'))
def edit_review_dashboard(id): if current_user.is_admin: review = models.Review.get(models.Review.id == id) form = forms.new_review(obj=review) if form.validate_on_submit(): q = models.Review.update( user = form.user.data, order_id = form.order_id.data, text = form.text.data ).where(models.Review.id == id) q.execute() return render_template("dashboard/html/review/edit.html", user=current_user, form=form) else: return redirect(url_for('index'))