aboutsummaryrefslogtreecommitdiff
path: root/budget
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-11-28 01:07:06 +0100
committerAlexis Metaireau <alexis@notmyidea.org>2011-11-28 01:07:06 +0100
commit05e7a7934a938853332504f3c863d16c8cf482cd (patch)
tree6944e20dd77506c8efa6b61b9bbc35dbb5d1b07c /budget
parent7dd7d1d14fbb3c85cbda4b0af4c949e17ce2329f (diff)
downloadihatemoney-mirror-05e7a7934a938853332504f3c863d16c8cf482cd.zip
ihatemoney-mirror-05e7a7934a938853332504f3c863d16c8cf482cd.tar.gz
ihatemoney-mirror-05e7a7934a938853332504f3c863d16c8cf482cd.tar.bz2
Fix #59. Edit now works properly
Diffstat (limited to 'budget')
-rw-r--r--budget/forms.py5
-rw-r--r--budget/web.py4
2 files changed, 5 insertions, 4 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 7d8d8e1..0e95c73 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -117,8 +117,7 @@ class BillForm(Form):
bill.amount=self.amount.data
bill.what=self.what.data
bill.date=self.date.data
- bill.owers = [Person.query.get(ower, project)
- for ower in self.payed_for.data]
+ bill.owers = [Person.query.get(ower, project) for ower in self.payed_for.data]
return bill
@@ -127,7 +126,7 @@ class BillForm(Form):
self.amount.data = bill.amount
self.what.data = bill.what
self.date.data = bill.date
- self.payed_for.data = [str(ower.id) for ower in bill.owers]
+ self.payed_for.data = [int(ower.id) for ower in bill.owers]
def set_default(self):
self.payed_for.data = self.payed_for.default
diff --git a/budget/web.py b/budget/web.py
index c5e0da2..2dc014a 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -333,7 +333,9 @@ def edit_bill(bill_id):
flash(_("The bill has been modified"))
return redirect(url_for('.list_bills'))
- form.fill(bill)
+ if not form.errors:
+ form.fill(bill)
+
return render_template("add_bill.html", form=form, edit=True)
@main.route("/lang/<lang>")