diff --git a/server/src/data/app.py b/server/src/data/app.py index be670d1..6c1a612 100644 --- a/server/src/data/app.py +++ b/server/src/data/app.py @@ -11,4 +11,11 @@ def submit(): value = request.form.get("query") print(value) items.append(value) + return redirect(url_for("mainpage")) +@app.route("/delete", methods=["POST"]) +def delete(): + value = request.form.get("item") + if value in items: + items.remove(value) + print("Deleting:", value) return redirect(url_for("mainpage")) \ No newline at end of file diff --git a/server/src/data/templates/index.html b/server/src/data/templates/index.html index 9709fc8..c2fab21 100644 --- a/server/src/data/templates/index.html +++ b/server/src/data/templates/index.html @@ -6,7 +6,7 @@
-
+
Liste des éléments
{% for item in items %} -
- {{ item }} +
+ {{ item }} + + + +
{% if not loop.last %}
{% endif %} - {% endfor %}