Compare commits

..

3 Commits

9
app.py
View File

@@ -65,23 +65,24 @@ def delete_compito(id):
compiti.remove(ciscomerda)
update_file()
return jsonify(ciscomerda), 200
update_file()
return jsonify([]), 404
@app.route("/ui")
def web_ui():
# Tabella compiti
html = "<table border>"
html = "<html><head>"
html += "<meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Gestione compiti</title>"
html += "</head><body><table border>"
for ciscomerda in compiti:
html += "<tr>"
html += f"<td>{ciscomerda["descrizione"]}</td><td><a href=\"/form_delete?id={ciscomerda["id"]}\" class=\"button\">Elimina</a>"
html += f"<td>{ciscomerda["descrizione"]}</td><td><a href=\"/form_delete?id={ciscomerda["id"]}\" class=\"button\"><button>Elimina</button></a>"
html += "</tr>"
html += "</table>"
html += "<form action=\"/form_add\">"
html += "<input type=\"text\" name=\"descrizione\" placeholder=\"Descrizione compito\">"
html += "<input type=\"submit\" value=\"Aggiungi compito\">"
html += "</form>"
html += "</form></body></html>"
return html, 200