- Timestamp:
- Feb 11, 2009, 11:11:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/models.py
r6637 r6662 6 6 #No need to formalize it; CHOICES don't change much 7 7 8 STATUS_CHOICES = ( 8 STATUS_CHOICES = ( 9 9 ('up', 'up'), 10 10 ('dw', 'down'), … … 51 51 return self.type 52 52 53 def delete(self): 54 # avoid deletion, unlink interfaces 55 # bound to the Antenna instead 56 for i in self.interface_set.all(): 57 i.save(); 58 super(Antenna, self).delete() 59 60 53 61 class EthernetToWifiBridge(models.Model): 54 62 type = models.CharField(max_length=10, unique=True) … … 56 64 def __unicode__(self): 57 65 return self.type 66 67 def delete(self): 68 # avoid deletion, unlink interfaces 69 # bound to the eth2wifi bridge instead 70 for i in self.interface_set_all(): 71 i.ethernet_to_wifi = None 72 i.save() 73 super(EthernetToWifiBridge, self).delete() 58 74 59 75 class Location(models.Model): … … 67 83 def __unicode__(self): 68 84 return self.description 69 70 def delete(self): 71 for i in self.node_set.all(): 72 i.delete() 73 super(Location, self).delete() 85 # overriding delete() method here is useless while we agree in 86 # deleting all nodes within a Location on its deletion 74 87 75 88 … … 95 108 def __unicode__(self): 96 109 return self.name 110 # overriding delete() method here is useless while we agree in 111 # deleting all nodes within a Network on its deletion 97 112 98 113 class Node(models.Model): … … 110 125 def __unicode__(self): 111 126 return self.name 112 113 def delete(self):114 for i in self.interface_set.all():115 i.delete116 super(Node, self).delete()117 127 118 128 class Interface(models.Model): … … 158 168 super(Interface, self).save(False, True) 159 169 160 161 170 def delete(self): 162 #import pdb; pdb.set_trace() ; 163 # remove reference to all other interfaces. 171 # unlink all linked interfaces. 172 for i in self.interface_set.all(): 173 i.link = None; 174 i.save(); 164 175 self.interface_set.clear() 165 176 super(Interface, self).delete()
Note:
See TracChangeset
for help on using the changeset viewer.