blob: 88a4008e721a93664804911a56a003da63640eb3 [file] [log] [blame]
Tony Macka7dbd422015-01-05 22:48:11 -05001from core.models import Site, SiteDeployment
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
Tony Macka7dbd422015-01-05 22:48:11 -05003from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter
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)
Tony Macka7dbd422015-01-05 22:48:11 -050010 site_deployments = SiteDeployment.objects.filter(site=site)
11 site_deployment_deleter = SiteDeploymentDeleter()
Sapan Bhatia26d40bc2014-05-12 15:28:02 -040012 for site_deployment in site_deployments:
13 site_deployment_deleter(site_deployment.id)
14 site.delete()