8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 03:43:12 +00:00

Surcharge mais n'override pas le clean

This commit is contained in:
Gabriel Detraz 2017-08-08 00:01:45 +02:00 committed by root
parent a0fa7cb718
commit 70b2368560

View file

@ -165,8 +165,10 @@ class Interface(models.Model):
return str(EUI(self.mac_address, dialect=mac_bare)).lower()
def clean(self, *args, **kwargs):
self.mac_address = str(EUI(self.mac_address)) or None
if not self.ipv4 or self.type.ip_type != self.ipv4.ip_type:
self.assign_ipv4()
super(Interface, self).clean(*args, **kwargs)
def assign_ipv4(self):
""" Assigne une ip à l'interface """