blob: 88a4008e721a93664804911a56a003da63640eb3 [file] [log] [blame]
Sapan Bhatia6d21da32014-11-11 21:41:12 -05001from core.models import Site, SiteDeployment
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
3from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter
4
5class SiteDeleter(Deleter):
6 model='Site'
7
8 def call(self, pk):
9 site = Site.objects.get(pk=pk)
Sapan Bhatia6d21da32014-11-11 21:41:12 -050010 site_deployments = SiteDeployment.objects.filter(site=site)
Sapan Bhatia26d40bc2014-05-12 15:28:02 -040011 site_deployment_deleter = SiteDeploymentDeleter()
12 for site_deployment in site_deployments:
13 site_deployment_deleter(site_deployment.id)
14 site.delete()