def todo_add(request): if request.method == 'POST': data = request.form() u = current_user(request) if len(data) > 0: t = Todo.new(data) t.user_id = u.id t.created_time = formatted_time(int(time.time())) t.updated_time = formatted_time(int(time.time())) t.save() return redirect('/todo')
def add(): todo = Todo.new(request.form) todo.save() todos = Todo.all() return render_template("todo.html", todos=todos)
def add(request): j = request.json() todo = Todo.new(j) todo.save() return json_response(todo.json())