delete label on last disassociate

This commit is contained in:
Chris Meyers
2016-04-25 17:14:09 -04:00
parent 16744e6b78
commit 2f18a9f2c1
5 changed files with 154 additions and 6 deletions

View File

@@ -39,3 +39,13 @@ class Label(CommonModelNameNotUnique):
jobtemplate_labels__isnull=True
)
@staticmethod
def is_detached(id):
return bool(
Label.objects.filter(
id=id,
unifiedjob_labels__isnull=True,
unifiedjobtemplate_labels__isnull=True
).count())