From b1665770e844e930a7dd4c11598c2a8e66aa0909 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sat, 3 Dec 2011 16:41:46 +0100 Subject: [PATCH] The 'submit and add a new one' button now acts as intended --- budget/web.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/budget/web.py b/budget/web.py index 5b10460..2a3715e 100644 --- a/budget/web.py +++ b/budget/web.py @@ -249,7 +249,7 @@ def list_bills(): return render_template("list_bills.html", bills=bills, member_form=MemberForm(g.project), bill_form=bill_form, - add_bill='add_bill' in request.values + add_bill=request.values.get('add_bill', False) ) @main.route("//members/add", methods=["GET", "POST"]) @@ -300,7 +300,12 @@ def add_bill(): db.session.commit() flash(_("The bill has been added")) - return redirect(url_for('.list_bills', add_bill=form.submit2.data)) + + args = {} + if form.submit2.data: + args['add_bill'] = True + + return redirect(url_for('.list_bills', **args)) return render_template("add_bill.html", form=form)