Commit 6da592f7 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Delete BackendNetworks when deleting a Backend

parent 737f41d7
......@@ -157,6 +157,11 @@ class Backend(models.Model):
else:
# ON_DELETE = SET NULL
self.virtual_machines.all().backend = None
# Remove BackendNetworks of this Backend.
# Do not use networks.all().delete(), since delete() method of
# BackendNetwork will not be called!
for net in self.networks.all():
net.delete()
super(Backend, self).delete(*args, **kwargs)
def __init__(self, *args, **kwargs):
......
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