Changeset 6578
- Timestamp:
- Jan 7, 2009, 9:41:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/models.py
r6565 r6578 127 127 direction = models.CharField(max_length=10, blank=True, null=True, 128 128 choices=DIRECTION_CHOICES) 129 link = models.ForeignKey('self', blank=True, null=True, 130 limit_choices_to = {'is_master': True }) 129 link = models.ForeignKey('self', blank=True, null=True) 131 130 ip = models.IPAddressField(unique=True, blank=True) 132 131 netmask = models.IntegerField(null=True, blank=True) … … 135 134 blank=True, null=True) 136 135 channel = models.IntegerField(blank=True, null=True) 137 is_master = models.BooleanField(editable=False)138 136 139 137 class Meta: … … 150 148 151 149 def save(self, force_insert=False, force_update=False): 152 if self.pk == None: 153 super(Interface, self).save(False, False) 150 super(Interface, self).save(False, False) 154 151 # If link is not defined we link to self. 155 152 if self.link == None: 156 153 self.link = self 157 # Master is defined so that only masters show up linkable.158 if self.pk == self.link_id:159 self.is_master = True160 super(Interface, self).save(False, True)161 else:162 self.is_master=False163 154 super(Interface, self).save(False, True) 164 155
Note:
See TracChangeset
for help on using the changeset viewer.