From 91f533ef830ac1a8cc8f46dd3b797c5f3d841a2a Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 18 Nov 2016 22:20:03 +0100 Subject: [PATCH] Hotfix --- machines/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/machines/models.py b/machines/models.py index aaf07606..0e2e264d 100644 --- a/machines/models.py +++ b/machines/models.py @@ -67,7 +67,10 @@ class Interface(models.Model): def clean(self, *args, **kwargs): self.mac_address = str(EUI(self.mac_address)) or None - alias = Alias.objects.filter(alias=self.dns).filter(extension=self.ipv4.ip_type.extension) + if self.ipv4: + alias = Alias.objects.filter(alias=self.dns).filter(extension=self.ipv4.ip_type.extension) + else: + alias = Alias.objects.filter(alias=self.dns) if alias: raise ValidationError("Impossible, le dns est déjà utilisé par un alias (%s)" % alias[0])