mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 16:42:25 +00:00
Fix port creation
This commit is contained in:
parent
021943405a
commit
52dce2d3f0
1 changed files with 3 additions and 2 deletions
|
@ -40,8 +40,9 @@ class Port(models.Model):
|
||||||
unique_together = ('switch', 'port')
|
unique_together = ('switch', 'port')
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.port > self.switch.number:
|
if hasattr(self, 'switch'):
|
||||||
raise ValidationError("Ce port ne peut exister, numero trop élevé")
|
if self.port > self.switch.number:
|
||||||
|
raise ValidationError("Ce port ne peut exister, numero trop élevé")
|
||||||
if self.room and self.machine_interface or self.room and self.related or self.machine_interface and self.related:
|
if self.room and self.machine_interface or self.room and self.related or self.machine_interface and self.related:
|
||||||
raise ValidationError("Chambre, interface et related_port sont mutuellement exclusifs")
|
raise ValidationError("Chambre, interface et related_port sont mutuellement exclusifs")
|
||||||
if self.related==self:
|
if self.related==self:
|
||||||
|
|
Loading…
Reference in a new issue