diff --git a/awx/main/models/label.py b/awx/main/models/label.py index b66db2a590..419fc68801 100644 --- a/awx/main/models/label.py +++ b/awx/main/models/label.py @@ -44,7 +44,7 @@ class Label(CommonModelNameNotUnique): inventory_labels__isnull=True, schedule_labels__isnull=True, workflowjobtemplatenode_labels__isnull=True, - workflowjobnode_labels=True, + workflowjobnode_labels__isnull=True, ).exists() def is_candidate_for_detach(self): diff --git a/awx/main/tests/unit/models/test_label.py b/awx/main/tests/unit/models/test_label.py index 43e890e0f5..e049a88578 100644 --- a/awx/main/tests/unit/models/test_label.py +++ b/awx/main/tests/unit/models/test_label.py @@ -34,7 +34,7 @@ class TestLabelFilterMocked: inventory_labels__isnull=True, schedule_labels__isnull=True, workflowjobtemplatenode_labels__isnull=True, - workflowjobnode_labels=True, + workflowjobnode_labels__isnull=True, ) mock_query_set.exists.assert_called_with() @@ -52,7 +52,7 @@ class TestLabelFilterMocked: inventory_labels__isnull=True, schedule_labels__isnull=True, workflowjobtemplatenode_labels__isnull=True, - workflowjobnode_labels=True, + workflowjobnode_labels__isnull=True, ) mock_query_set.exists.assert_called_with()