8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +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() return str(EUI(self.mac_address, dialect=mac_bare)).lower()
def filter_macaddress(self): def filter_macaddress(self):
mac_address = str(EUI(self.mac_address)) try:
if mac_address: self.mac_address = str(EUI(self.mac_address))
self.mac_address = mac_address except :
else:
raise ValidationError("La mac donnée est invalide") raise ValidationError("La mac donnée est invalide")
def clean(self, *args, **kwargs): def clean(self, *args, **kwargs):