def get(self): tasks = Tasks.query(Tasks.archived == False).fetch() tasks.sort(key=lambda r: r.date, reverse=True) params = {"tasks": tasks} return self.render_template("tasks.html", params=params)
def post(self, task_id): task = Tasks.get_by_id(int(task_id)) task.archived = False task.put() time.sleep(0.1) if Tasks.query(Tasks.archived == True).fetch(): return self.redirect_to("archived") else: return self.redirect_to("tasks")
def get(self): tasks = Tasks.query(Tasks.archived == True).fetch() tasks.sort(key=lambda r: r.date, reverse=True) if tasks: params = {"tasks": tasks} else: params = {"message": "There are no completed tasks."} return self.render_template("archived.html", params=params)
def get(self, task_id): task = Tasks.get_by_id(int(task_id)) task.archived = True task.put() time.sleep(0.1) tasks = Tasks.query(Tasks.archived == False).fetch() tasks.sort(key=lambda r: r.date, reverse=True) params = {"tasks": tasks, "task_id": task_id} return self.render_template("archive_task.html", params=params)