From 24e0d8348fb5855d0255b41ec1ca9beaf233d9a6 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 3 Sep 2018 20:53:37 +0200 Subject: [PATCH] Fix double-click when deleting a bill (#349) (#372) When double-clicking on the delete button, the first click actually deletes the bill, and the second click does the same action again. But as the bill is already deleted, it displays a 404 page which can be misleading. This fix makes the app trigger a redirect when the bill seem to doesn't exist, fixing this strange behaviour. --- ihatemoney/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index b462fe4c..f6f04af5 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -514,7 +514,7 @@ def delete_bill(bill_id): # fixme: everyone is able to delete a bill bill = Bill.query.get(g.project, bill_id) if not bill: - raise NotFound() + return redirect(url_for('.list_bills')) db.session.delete(bill) db.session.commit()