Sapan Bhatia | 26d40bc | 2014-05-12 15:28:02 -0400 | [diff] [blame] | 1 | from core.models import User, UserDeployments |
2 | from observer.deleter import Deleter | ||||
3 | from observer.deleters.user_deployment_deleter import UserDeploymentDeleter | ||||
4 | |||||
5 | class UserDeleter(Deleter): | ||||
6 | model='User' | ||||
7 | |||||
8 | def call(self, pk): | ||||
9 | user = User.objects.get(pk=pk) | ||||
10 | user_deployment_deleter = UserDeploymentDeleter() | ||||
11 | for user_deployment in UserDeployments.objects.filter(user=user): | ||||
12 | user_deployment_deleter(user_deployment.id) | ||||
13 | user.delete() |