def get(self, task_id=0, **kwargs): task = Task.get_by_id(task_id) if not task: abort(404) return task
def delete(self, task_id=0, **kwargs): task = Task.get_by_id(task_id) if not task: abort(404) task.delete() return 204
def post(self, task_id=0, **kwargs): task = Task.get_by_id(task_id) if not task: abort(404) task.update(**task_parser.parse_args()) return task
def post(self, user_id=None, username=None): args = task_parser.parse_args() # user owns the task args['user_id'] = g.user.id task = Task.create(**args) return task, 201