def new_reimbursement(): form = ReimbursementRequestForm() if form.validate_on_submit(): reimbursement = ReimbursementRequest(form.name.data, current_user, form.race.data, ReimbursementRequestStatus.PENDING, form.comments.data) db.session.add(reimbursement) db.session.commit() return redirect(url_for('new_reimbursement_item', request_id=reimbursement.id)) form.race.query_factory=lambda:Race.query.all() return render_template("new_reimbursement.html", active_page='none', form=form)
def edit_reimbursement(): form = ReimbursementRequestForm() if form.validate_on_submit(): pass reimbursement = ReimbursementRequest.query.get(int(request.args.get('request_id'))) if not(reimbursement) or reimbursement.user != current_user: abort(401) form = ReimbursementRequestForm(name=reimbursement.name, race=reimbursement.race, comments=reimbursement.comments) form.race.query_factory=lambda:Race.query.all() return render_template("new_reimbursement.html", active_page='none', form=form)