mark todos as done

Amara Okoye 10 months ago
parent 916f85fc53 commit d7fd2ec9620a1e44a61aefe43632a8273adb341f
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)