Sapan Bhatia | 3d872e5 | 2014-11-11 21:41:12 -0500 | [diff] [blame] | 1 | from core.models import Site, SiteDeployment |
Sapan Bhatia | 26d40bc | 2014-05-12 15:28:02 -0400 | [diff] [blame] | 2 | from observer.deleter import Deleter |
| 3 | from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter |
| 4 | |
| 5 | class SiteDeleter(Deleter): |
| 6 | model='Site' |
| 7 | |
| 8 | def call(self, pk): |
| 9 | site = Site.objects.get(pk=pk) |
Sapan Bhatia | 3d872e5 | 2014-11-11 21:41:12 -0500 | [diff] [blame] | 10 | site_deployments = SiteDeployment.objects.filter(site=site) |
Sapan Bhatia | 26d40bc | 2014-05-12 15:28:02 -0400 | [diff] [blame] | 11 | site_deployment_deleter = SiteDeploymentDeleter() |
| 12 | for site_deployment in site_deployments: |
| 13 | site_deployment_deleter(site_deployment.id) |
| 14 | site.delete() |