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/")