From 5cbf08d557b77d805142e851fa8377af0081e4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Sun, 5 Aug 2018 19:29:35 +0200 Subject: [PATCH] Fix double-click when deleting a bill (#349) 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 6e876c03..4bf12e6b 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -513,7 +513,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()