Exemplo n.º 1
0
def edit_todo_item(todo_key, json):
  todo = TodoItem.get(todo_key)
  if json.get("title"):
    todo.title = json["title"]

  if json.get("desc"):
    todo.desc = json["desc"]

  if json.get("duedate"):
    todo.duedate = datetime.strptime(json["duedate"], "%m/%d/%Y")

  if json["categories"]:
    todo.removeIndex("category_bin", silent=True)
    todo.addIndex("category_bin", json["categories"][0])

  if json["assignee"] and json["assignee"] != "noone":
    todo.removeIndex("assigned_to_bin", silent=True)
    todo.addIndex("assigned_to_bin", json["assignee"])

  todo.save()
  return todo
Exemplo n.º 2
0
def mark_todo_done(todo_key, done):
  todo = TodoItem.get(todo_key)
  todo.done = done
  todo.save()
Exemplo n.º 3
0
def delete_todo_item(todo_key):
  TodoItem.get(todo_key).delete()
Exemplo n.º 4
0
def get_todo_json(todo_key):
  return todo_to_json(TodoItem.get(todo_key))