From 18ab2b3ca28f0a556c93b50d8f86ca8ea257ffcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fukan=20=C3=9Crker?= Date: Wed, 17 Jan 2024 15:49:21 +0300 Subject: [PATCH] added flash messages after post deleting --- routes/adminPanelPosts.py | 2 ++ routes/dashboard.py | 1 + routes/post.py | 1 + 3 files changed, 4 insertions(+) diff --git a/routes/adminPanelPosts.py b/routes/adminPanelPosts.py index 60e0f5cc..985c7f8c 100644 --- a/routes/adminPanelPosts.py +++ b/routes/adminPanelPosts.py @@ -1,4 +1,5 @@ from helpers import ( + flash, sqlite3, session, request, @@ -28,6 +29,7 @@ def adminPanelPosts(): if request.method == "POST": if "postDeleteButton" in request.form: deletePost(request.form["postID"]) + flash("post deleted", "error") match role == "admin": case True: connection = sqlite3.connect(DB_POSTS_ROOT) diff --git a/routes/dashboard.py b/routes/dashboard.py index da4aa8f6..88caec07 100644 --- a/routes/dashboard.py +++ b/routes/dashboard.py @@ -25,6 +25,7 @@ def dashboard(userName): if request.method == "POST": if "postDeleteButton" in request.form: deletePost(request.form["postID"]) + flash("post deleted", "error") return ( redirect( url_for("dashboard.dashboard", userName=userName) diff --git a/routes/post.py b/routes/post.py index ab607d85..712bc040 100644 --- a/routes/post.py +++ b/routes/post.py @@ -45,6 +45,7 @@ def post(postID): if request.method == "POST": if "postDeleteButton" in request.form: deletePost(postID) + flash("post deleted", "error") return redirect(f"/") elif "commentDeleteButton" in request.form: deleteComment(request.form["commentID"])