From 55a0be1d15b94466ffaaeb818d7d6aa928d796fb Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 8 Aug 2017 00:01:45 +0200 Subject: [PATCH] Surcharge mais n'override pas le clean --- machines/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/machines/models.py b/machines/models.py index 247ca0f7..d41bc6bb 100644 --- a/machines/models.py +++ b/machines/models.py @@ -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 """