def add_todo(): for x in range(100): todo = Todo() todo.todo_desc = "test plan--" + str(x) + str(x) + str(x) todo.todo_status = random.randint(0, 1) todo.todo_type = random.randint(1, 3) todo.todo_date = date(2015, random.randint(1, 12), random.randint(1, 27)) db.session.add(todo) db.session.commit()
def todo_add_from_plan(): json_data = request.get_json() todo_desc = json_data.get('todo_desc') if todo_desc is not None: _todo = Todo() _todo.todo_desc = todo_desc _todo.todo_type = Todo.TYPE_PLAN db.session.add(_todo) db.session.commit() return jsonify(success=True) return jsonify(success=False)