diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:41:28 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:41:28 +0200 |
| commit | 2df6e11f05eff9bd855079097aa865f52689d7ca (patch) | |
| tree | 6de593b6d68b2ee91c211af71a3168ba261293cf /budget/web.py | |
| parent | 3bbc3343a2409de3cccdd7f50360e631224bf066 (diff) | |
| download | ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.zip ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.tar.gz ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.tar.bz2 | |
Adding a bill is now working properly
Diffstat (limited to 'budget/web.py')
| -rw-r--r-- | budget/web.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/budget/web.py b/budget/web.py index 10b2d4a..f313266 100644 --- a/budget/web.py +++ b/budget/web.py @@ -123,18 +123,11 @@ def add_bill(project): form = get_billform_for(project.id) if request.method == 'POST': if form.validate(): - bill = Bill() - form.populate_obj(bill) - - for ower in form.payed_for.data: - ower = BillOwer(name=ower) - db.session.add(ower) - bill.owers.append(ower) - - db.session.add(bill) + db.session.add(form.save()) db.session.commit() + flash("The bill have been added") - return redirect(url_for('list_bills')) + return redirect(url_for('list_bills', project_id=project.id)) return render_template("add_bill.html", form=form, project=project) |
