blob: b8ca6a1e61c8c687dfe298a377eb3afc4bf23b05 [file] [log] [blame]
Sapan Bhatiab55f4a32014-11-19 15:07:36 -05001from core.models import Site, SiteDeployments
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
Sapan Bhatiab55f4a32014-11-19 15:07:36 -05003from observer.deleters.site_deployment_deleter import SiteDeploymentsDeleter
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04004
5class SiteDeleter(Deleter):
6 model='Site'
7
8 def call(self, pk):
9 site = Site.objects.get(pk=pk)
Sapan Bhatiab55f4a32014-11-19 15:07:36 -050010 site_deployments = SiteDeployments.objects.filter(site=site)
11 site_deployment_deleter = SiteDeploymentsDeleter()
Sapan Bhatia26d40bc2014-05-12 15:28:02 -040012 for site_deployment in site_deployments:
13 site_deployment_deleter(site_deployment.id)
14 site.delete()