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

Filtre les mac illisibles, non valide et None

This commit is contained in:
Maël Kervella 2017-09-19 20:09:12 +00:00 committed by Pierre Cadart
parent 6dbfbb894a
commit fb6a522614

View file

@ -235,10 +235,9 @@ class Interface(models.Model):
return str(EUI(self.mac_address, dialect=mac_bare)).lower()
def filter_macaddress(self):
mac_address = str(EUI(self.mac_address))
if mac_address:
self.mac_address = mac_address
else:
try:
self.mac_address = str(EUI(self.mac_address))
except :
raise ValidationError("La mac donnée est invalide")
def clean(self, *args, **kwargs):