blob: 3930eb09c49d1541dabd095db62826ebf9e18e32 [file] [log] [blame]
Sapan Bhatiae20777d2014-11-19 15:10:51 -05001from core.models import User, UserDeployments
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04002from observer.deleter import Deleter
Sapan Bhatiae20777d2014-11-19 15:10:51 -05003from observer.deleters.user_deployment_deleter import UserDeploymentsDeleter
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04004
5class UserDeleter(Deleter):
6 model='User'
7
8 def call(self, pk):
9 user = User.objects.get(pk=pk)
Sapan Bhatiae20777d2014-11-19 15:10:51 -050010 user_deployment_deleter = UserDeploymentsDeleter()
11 for user_deployment in UserDeployments.objects.filter(user=user):
Sapan Bhatia26d40bc2014-05-12 15:28:02 -040012 user_deployment_deleter(user_deployment.id)
13 user.delete()