本文整理汇总了Python中models.Todo.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Todo.get_by_id方法的具体用法?Python Todo.get_by_id怎么用?Python Todo.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Todo
的用法示例。
在下文中一共展示了Todo.get_by_id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def post(self,task_id):
vnos = self.request.get("vnos")
task = Todo.get_by_id(int(task_id))
task.vsebina = vnos
task.put()
self.redirect_to("todo_seznam") #to je ta url iz handlerja (ne ime template)
示例2: update_todo
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def update_todo(id):
todo = Todo.get_by_id(id)
data = json.loads(request.data)
todo.content = data['content']
todo.done = data['done']
todo.save()
return jsonify(id=id, content=todo.content, done=todo.done)
示例3: post
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def post(self, task_id):
task = Todo.get_by_id(int(task_id))
task.task = self.request.get("task")
task.task = self.validation(task.task)
task.put()
self.redirect("/task/" + task_id)
示例4: get
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def get(self, task_id):
task = Todo.get_by_id(int(task_id))
view_vars = {
"task": task
}
return self.render_template("izbrisi_sporocilo.html", view_vars)
示例5: delete_todo
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def delete_todo(id):
Todo.get_by_id(id).delete()
return jsonify()
示例6: get
# 需要导入模块: from models import Todo [as 别名]
# 或者: from models.Todo import get_by_id [as 别名]
def get(self,task_id):
task = Todo.get_by_id(int(task_id))
task.dokoncan = True # ce hocemo trajno zbrisat sporocilo: sporocilo.key.delete() in potem redirect
task.put()
self.redirect_to("todo_seznam")