mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Fix #59. Edit now works properly
This commit is contained in:
parent
7dd7d1d14f
commit
05e7a7934a
2 changed files with 5 additions and 4 deletions
|
@ -117,8 +117,7 @@ class BillForm(Form):
|
||||||
bill.amount=self.amount.data
|
bill.amount=self.amount.data
|
||||||
bill.what=self.what.data
|
bill.what=self.what.data
|
||||||
bill.date=self.date.data
|
bill.date=self.date.data
|
||||||
bill.owers = [Person.query.get(ower, project)
|
bill.owers = [Person.query.get(ower, project) for ower in self.payed_for.data]
|
||||||
for ower in self.payed_for.data]
|
|
||||||
|
|
||||||
return bill
|
return bill
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ class BillForm(Form):
|
||||||
self.amount.data = bill.amount
|
self.amount.data = bill.amount
|
||||||
self.what.data = bill.what
|
self.what.data = bill.what
|
||||||
self.date.data = bill.date
|
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):
|
def set_default(self):
|
||||||
self.payed_for.data = self.payed_for.default
|
self.payed_for.data = self.payed_for.default
|
||||||
|
|
|
@ -333,7 +333,9 @@ def edit_bill(bill_id):
|
||||||
flash(_("The bill has been modified"))
|
flash(_("The bill has been modified"))
|
||||||
return redirect(url_for('.list_bills'))
|
return redirect(url_for('.list_bills'))
|
||||||
|
|
||||||
|
if not form.errors:
|
||||||
form.fill(bill)
|
form.fill(bill)
|
||||||
|
|
||||||
return render_template("add_bill.html", form=form, edit=True)
|
return render_template("add_bill.html", form=form, edit=True)
|
||||||
|
|
||||||
@main.route("/lang/<lang>")
|
@main.route("/lang/<lang>")
|
||||||
|
|
Loading…
Reference in a new issue