예제 #1
0
    def get(self, task_id):
        """ Deletes task """
        task = TaskModel.objects(id=task_id).first()
        if task is None:
            return {"message": "Invalid task id"}, 400

        return {'logs': task.logs}
예제 #2
0
    def delete(self, task_id):
        """ Deletes task """
        task = TaskModel.objects(id=task_id).first()

        if task is None:
            return {"message": "Invalid task id"}, 400

        if not task.completed:
            return {"message": "Task is not completed"}, 400

        task.delete()
        return {"success": True}