diff --git a/awx/api/views.py b/awx/api/views.py index 4af8a6561e..64ea980f66 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -2189,9 +2189,6 @@ class JobTemplateDetail(RetrieveUpdateDestroyAPIView): can_delete = request.user.can_access(JobTemplate, 'delete', obj) if not can_delete: raise PermissionDenied("Cannot delete job template.") - if obj.jobs.filter(status__in=['new', 'pending', 'waiting', 'running']).exists(): - return Response({"error": "Delete not allowed while there are jobs running"}, - status=status.HTTP_405_METHOD_NOT_ALLOWED) return super(JobTemplateDetail, self).destroy(request, *args, **kwargs) diff --git a/awx/main/access.py b/awx/main/access.py index 3b75a6cd98..af05c58be6 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -761,7 +761,7 @@ class ProjectAccess(BaseAccess): return self.user in obj.admin_role def can_delete(self, obj): - is_change_allowed = self.can_change(obj, None) + is_change_allowed = self.can_change(obj, None) if not is_change_allowed: return False active_jobs = []