Commit a2dc53a3 authored by Lukas Burgey's avatar Lukas Burgey

Add deletion hack to users

parent 50740229
......@@ -165,6 +165,31 @@ class User(AbstractUser):
client.set_password(password)
return client
def delete(self, *args, **kwargs):
LOGGER.info('Deleting User %s', self)
from . import deployments
# TODO these deletions are a hack. django should (TM) be able to delete them itself
# but there seems to be a bug
for dep in deployments.ServiceDeployment.objects.filter(user=self):
LOGGER.debug('Deleting users service deployment %s', dep)
dep.delete()
for dep in deployments.VODeployment.objects.filter(user=self):
LOGGER.debug('Deleting users vo deployment %s', dep)
dep.delete()
for dep in deployments.Deployment.objects.filter(user=self):
LOGGER.debug('Deleting users deployment %s', dep)
dep.delete()
LOGGER.info('User has: %s', self.deployments.all())
for dep in self.deployments.all():
dep.delete()
super(User, self).delete(*args, **kwargs)
def __str__(self):
name = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment