Fixed flash message in confirm_save.py
This commit is contained in:
parent
312a54e624
commit
5c22dbcc31
@ -50,5 +50,4 @@ def confirm_save():
|
|||||||
|
|
||||||
# Clear session data after successful insertion
|
# Clear session data after successful insertion
|
||||||
session.pop('assets', None)
|
session.pop('assets', None)
|
||||||
flash("Data successfully saved to the database.", "success")
|
|
||||||
return redirect('/viewall')
|
return redirect('/viewall')
|
@ -8,34 +8,20 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>Upload CSV File</h1>
|
<h1>Upload CSV File</h1>
|
||||||
|
|
||||||
<!-- Display error messages -->
|
<!-- Display flash messages (only errors) -->
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
{% with messages = get_flashed_messages(category_filter=["error"]) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<details>
|
<details>
|
||||||
<summary>Errors found during submission (click to expand):</summary>
|
<summary>Errors found during submission (click to expand):</summary>
|
||||||
<ul>
|
<ul>
|
||||||
{% for category, message in messages %}
|
{% for message in messages %}
|
||||||
<li><strong>{{ category }}:</strong> {{ message }}</li>
|
<li>{{ message }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
<!-- Display validation errors if any -->
|
|
||||||
{% if errors %}
|
|
||||||
<details>
|
|
||||||
<summary>
|
|
||||||
Errors found in the CSV file (click to expand):
|
|
||||||
</summary>
|
|
||||||
<ul>
|
|
||||||
{% for error in errors %}
|
|
||||||
<li>{{ error }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- Upload form -->
|
<!-- Upload form -->
|
||||||
<form action="/uploadcsv" method="POST" enctype="multipart/form-data">
|
<form action="/uploadcsv" method="POST" enctype="multipart/form-data">
|
||||||
<label for="file">Choose a CSV file:</label>
|
<label for="file">Choose a CSV file:</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user