def delete_details(Key): delete = todos.get_key(Key - 1) form = TodoForm(data=delete) if request.method == "POST": if form.validate_on_submit(): todos.delete_record(Key - 1, form.data) return redirect(url_for("delete_list")) return render_template("delete.html", form=form, Key=Key)
def todo_details(todo_id): todo = todos.get(todo_id - 1) form = TodoForm(data=todo) if request.method == "POST": if form.validate_on_submit(): todos.update(tod_id - 1, form.data) return redirect(url_for("todos_list")) return render_template("todo.html", form=form, todo_id=todo_id)
def todos_list(): form = TodoForm() error = "" if request.method == "POST": if form.validate_on_submit(): todos.create(form.data) todos.save_all() return redirect(url_for("todos_list")) return render_template("todos.html", form=form, todos=todos.all(), error=error)
def todos_list(): form = TodoForm() error = "" todos.__init__() if request.method == "POST": if form.validate_on_submit(): todos.add_record(form.data) return redirect(url_for("todos_list")) return render_template("todos.html", form=form, todos=todos.select_all(), error=error)