aboutsummaryrefslogtreecommitdiff
path: root/budget/budget.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-03-18 19:44:40 +0000
committerAlexis Metaireau <alexis@notmyidea.org>2011-03-18 19:44:40 +0000
commit54de7abf23f61df916fe65f590d0d45ec8e2d174 (patch)
tree3b17ebb6dfa38dead23c650531de5ae6bdb27a8b /budget/budget.py
parent03ce000e9a7edc6989bc3d40243f769746ea3d22 (diff)
downloadihatemoney-mirror-54de7abf23f61df916fe65f590d0d45ec8e2d174.zip
ihatemoney-mirror-54de7abf23f61df916fe65f590d0d45ec8e2d174.tar.gz
ihatemoney-mirror-54de7abf23f61df916fe65f590d0d45ec8e2d174.tar.bz2
add a delete feature
Diffstat (limited to 'budget/budget.py')
-rw-r--r--budget/budget.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/budget/budget.py b/budget/budget.py
index e22b053..6a579f1 100644
--- a/budget/budget.py
+++ b/budget/budget.py
@@ -125,6 +125,14 @@ def reset_bills():
return redirect(url_for('list_bills'))
+@app.route("/delete/<int:bill_id>")
+def delete_bill(bill_id):
+ Bill.query.filter(Bill.id == bill_id).delete()
+ BillOwer.query.filter(BillOwer.bill_id == bill_id).delete()
+ db.session.commit()
+ flash("the bill was deleted")
+
+ return redirect(url_for('list_bills'))
if __name__ == '__main__':
app.run(host="0.0.0.0", debug=True)