def get_todo_detail(self, todo_id): sql = "select * from todo where id = %s;" n = cursor.execute(sql) if not n: return None data = cursor.fetchall() return TodoModel.load(data)[0]
def get_todo_list(self): sql = "select * from todo;" n = cursor.execute(sql) if not n: return [] data = cursor.fetchall() return TodoModel.load(data)