From 2459122c33bbb00c6491b4a1db0dae8faca84b57 Mon Sep 17 00:00:00 2001
From: Felix Chadwick-Smith <chadwick-smithff@cardiff.ac.uk>
Date: Sun, 14 Jan 2024 15:52:46 +0000
Subject: [PATCH]  modified the add_project route in your Flask application to
 include flash messages upon successful submission of the project form and
 redirected to the home page.

---
 my_flask_app.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/my_flask_app.py b/my_flask_app.py
index e334162..0bc65db 100644
--- a/my_flask_app.py
+++ b/my_flask_app.py
@@ -67,11 +67,11 @@ def add_project():
         new_project = Project(title=title, description=description)
         db.session.add(new_project)
         db.session.commit()
-        return redirect(url_for('Home'))
-
-    return render_template('add_project.html', form=form)  # Pass the form to the template
 
+        flash('Project added successfully!', 'success')  # Flash success message
+        return redirect(url_for('home'))
 
+    return render_template('add_project.html', form=form)
 # Updated route for serving the 'my-cv.docx' file
 @app.route('/download_cv')
 def download_cv():
-- 
GitLab