def post(self): title = self.request.get("title") description = self.request.get("description") dueDate = self.request.get("dueDate") fixedDueDate = self.fixDueDate(dueDate) priority = self.request.get("priority") user = self.getUserFromCookie() userId = user.key().id() newTask = taskModel.Task(title = title,description = description, dueDate = dueDate, fixedDueDate = fixedDueDate, priority = priority, userId = userId, parent=taskModel.taskAncestorKey(userId)) newTask.put() self.redirect('/homepage')
def get(self,taskId): user = self.getUserFromCookie() userId= user.key().id() task = taskModel.Task.get_by_id(int(taskId), parent = taskModel.taskAncestorKey(userId)) fields = {'user': user,'userTask':task} self.renderStart('templates/task.html',fields=fields)
def getTasks(self, userId): tasksQuery = taskModel.Task.all() tasksQuery = tasksQuery.ancestor(taskModel.taskAncestorKey(userId)) tasksQuery = tasksQuery.order(SortMethod) return tasksQuery