Sapan Bhatia | 13d2db9 | 2014-11-11 21:47:45 -0500 | [diff] [blame] | 1 | from core.models import User, UserDeployment |
Sapan Bhatia | 26d40bc | 2014-05-12 15:28:02 -0400 | [diff] [blame] | 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() |
Sapan Bhatia | 84ba65d | 2014-11-11 21:44:35 -0500 | [diff] [blame] | 11 | for user_deployment in UserDeployment.objects.filter(user=user): |
Sapan Bhatia | 26d40bc | 2014-05-12 15:28:02 -0400 | [diff] [blame] | 12 | user_deployment_deleter(user_deployment.id) |
| 13 | user.delete() |