git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a2089df
)
cleanup network objects associated with slice that's deleted
author
Tony Mack
<tmack@tux.cs.princeton.edu>
Wed, 22 Oct 2014 17:30:41 +0000
(13:30 -0400)
committer
Tony Mack
<tmack@tux.cs.princeton.edu>
Wed, 22 Oct 2014 17:30:41 +0000
(13:30 -0400)
planetstack/core/models/slice.py
patch
|
blob
|
history
diff --git
a/planetstack/core/models/slice.py
b/planetstack/core/models/slice.py
index
7915d42
..
7412fe2
100644
(file)
--- a/
planetstack/core/models/slice.py
+++ b/
planetstack/core/models/slice.py
@@
-87,6
+87,13
@@
class Slice(PlCoreBase):
qs = Slice.objects.filter(id__in=slice_ids)
return qs
+ def delete(self, *args, **kwds):
+ # delete networks associated with this slice
+ from core.models.network import Network
+ nets = Network.objects.filter(slices=self)
+ nets.delete()
+ super(SliceAdmin, self).delete(*args, **kwds)
+
class SliceRole(PlCoreBase):
ROLE_CHOICES = (('admin','Admin'),('default','Default'))