8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Fix port creation

This commit is contained in:
lhark 2016-11-19 03:10:05 +01:00
parent 021943405a
commit 52dce2d3f0

View file

@ -40,6 +40,7 @@ class Port(models.Model):
unique_together = ('switch', 'port') unique_together = ('switch', 'port')
def clean(self): def clean(self):
if hasattr(self, 'switch'):
if self.port > self.switch.number: if self.port > self.switch.number:
raise ValidationError("Ce port ne peut exister, numero trop élevé") 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: