From 52fdc8c2120e459772e221c68b25bf6e7060f6f8 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 29 May 2018 17:20:11 +0100 Subject: Add clear all button to notifications page --- app/views/notifications.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/notifications.py b/app/views/notifications.py index 4515ae5..23dbb31 100644 --- a/app/views/notifications.py +++ b/app/views/notifications.py @@ -23,4 +23,11 @@ from app.models import * @app.route("/notifications/") @login_required def notifications_page(): - return render_template("notifications/list.html") + return render_template("notifications/list.html") + +@app.route("/notifications/clear/", methods=["POST"]) +@login_required +def clear_notifications_page(): + current_user.notifications.clear() + db.session.commit() + return redirect(url_for("notifications_page")) -- cgit v1.2.3