blob: c97dee13b7336557a7ea1e04cec54f38ab3d034d [file] [log] [blame]
Tony Mackbdb188a2014-04-01 20:24:47 -04001from core.models import Site, SiteDeployments
Tony Macke4be32f2014-03-11 20:45:25 -04002from observer.deleter import Deleter
Tony Mack79e78c82014-04-12 10:26:15 -04003from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter
Tony Mack387a73f2013-09-18 07:59:14 -04004
5class SiteDeleter(Deleter):
6 model='Site'
7
8 def call(self, pk):
9 site = Site.objects.get(pk=pk)
Tony Mackbdb188a2014-04-01 20:24:47 -040010 site_deployments = SiteDeployments.objects.filter(site=site)
Tony Mack79e78c82014-04-12 10:26:15 -040011 site_deployment_deleter = SiteDeploymentDeleter()
Tony Mackbdb188a2014-04-01 20:24:47 -040012 for site_deployment in site_deployments:
Tony Mack79e78c82014-04-12 10:26:15 -040013 site_deployment_deleter(site_deployment.id)
Tony Mack387a73f2013-09-18 07:59:14 -040014 site.delete()