diff --git a/awx/api/views.py b/awx/api/views.py index bea9711da9..de88b44518 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1152,7 +1152,7 @@ class ProjectUpdateDetail(RetrieveDestroyAPIView): def destroy(self, request, *args, **kwargs): obj = self.get_object() - if obj.unified_job_nodes.filter(workflow_job__status__in=ACTIVE_STATES).exists(): + if obj.unified_job_node.filter(workflow_job__status__in=ACTIVE_STATES).exists(): raise PermissionDenied(detail=_('Cannot delete job resource when associated workflow job is running.')) return super(ProjectUpdateDetail, self).destroy(request, *args, **kwargs) @@ -2303,7 +2303,7 @@ class InventoryUpdateDetail(RetrieveDestroyAPIView): def destroy(self, request, *args, **kwargs): obj = self.get_object() - if obj.unified_job_nodes.filter(workflow_job__status__in=ACTIVE_STATES).exists(): + if obj.unified_job_node.filter(workflow_job__status__in=ACTIVE_STATES).exists(): raise PermissionDenied(detail=_('Cannot delete job resource when associated workflow job is running.')) return super(InventoryUpdateDetail, self).destroy(request, *args, **kwargs) @@ -3297,7 +3297,7 @@ class JobDetail(RetrieveUpdateDestroyAPIView): def destroy(self, request, *args, **kwargs): obj = self.get_object() - if obj.unified_job_nodes.filter(workflow_job__status__in=ACTIVE_STATES).exists(): + if obj.unified_job_node.filter(workflow_job__status__in=ACTIVE_STATES).exists(): raise PermissionDenied(detail=_('Cannot delete job resource when associated workflow job is running.')) return super(JobDetail, self).destroy(request, *args, **kwargs)