DeploymentLinkDeletionManager for filtering deployment-linked objects
such as UserDeployments and SliceDeployments.
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 282368f..a5cea69 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -6,6 +6,19 @@
from geoposition.fields import GeopositionField
from core.acl import AccessControlList
+class DeploymentLinkDeletionManager(PlCoreBaseDeletionManager):
+ def get_queryset(self):
+ parent=super(DeploymentLinkDeletionManager, self)
+ if hasattr(parent, "get_queryset"):
+ return parent.get_queryset().filter(Q(deployment__backend_type=config.observer_backend_type)|Q(backend_type=None))
+ else:
+ return parent.get_queryset().filter(Q(deployment__backend_type=config.observer_backend_type)|Q(backend_type=None))
+
+ # deprecated in django 1.7 in favor of get_queryset().
+ def get_query_set(self):
+ return self.get_queryset()
+
+
class DeploymentDeletionManager(PlCoreBaseDeletionManager):
def get_queryset(self):
parent=super(DeploymentDeletionManager, self)