mark todos as done

Alex Moreau 1 year ago
parent fe518f3dce commit d54e1eb23734466dc6eaf4928d80562d6d6c7ac2
1 changed files with 11 additions and 0 deletions
+11-0app.py
View File
@@ -15,3 +15,14 @@
1515 if title:
1616 todos.append({"title": title, "done": False})
1717 return redirect("/")
18+
19+
20+@app.post("/done/<int:index>")
21+def done(index):
22+ if 0 <= index < len(todos):
23+ todos[index]["done"] = True
24+ return redirect("/")
25+
26+
27+if __name__ == "__main__":
28+ app.run(debug=True)