include related Jobs in group del protection

This commit is contained in:
AlanCoding
2018-03-19 14:16:15 -04:00
parent e58038b056
commit 001fa634aa
2 changed files with 28 additions and 1 deletions
+4 -1
View File
@@ -960,7 +960,10 @@ class Group(CommonModelNameNotUnique, RelatedJobsMixin):
RelatedJobsMixin
'''
def _get_related_jobs(self):
return InventoryUpdate.objects.filter(inventory_source__in=self.inventory_sources.all())
return UnifiedJob.objects.non_polymorphic().filter(
Q(Job___inventory=self.inventory) |
Q(InventoryUpdate___inventory_source__groups=self)
)
class InventorySourceOptions(BaseModel):