def index(): form = TodoForm() todos = Todo.objects.order_by('-time') return render_template("index.html", todos=todos, form=form)
def delete(todo_id): form = TodoForm() todo = Todo.objects.get_or_404(id=todo_id) todo.delete() todos = Todo.objects.order_by('-time') return render_template('index.html', todos = todos, form = form)