From 485a21f13ee73c25ccd99a029a4f3616eee35bc2 Mon Sep 17 00:00:00 2001 From: Zach Moody Date: Mon, 16 Jan 2017 16:52:03 -0600 Subject: [PATCH] cleaned up IPAddress clean() to be more like Prefix's --- netbox/ipam/models.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/netbox/ipam/models.py b/netbox/ipam/models.py index 62faacb18..8e45277ab 100644 --- a/netbox/ipam/models.py +++ b/netbox/ipam/models.py @@ -422,19 +422,13 @@ class IPAddress(CreatedUpdatedModel, CustomFieldModel): return reverse('ipam:ipaddress', args=[self.pk]) def clean(self): - if ((not self.vrf and settings.ENFORCE_GLOBAL_UNIQUE) or (self.vrf and self.vrf.enforce_unique)): - dupes = IPAddress.objects.duplicates(self) - if dupes: - raise ValidationError({ - 'address': "Duplicate IP address found in global table: {}".format(dupes.first()) - }) # Enforce unique IP space if applicable if ((not self.vrf and settings.ENFORCE_GLOBAL_UNIQUE) or (self.vrf and self.vrf.enforce_unique)): dupes = IPAddress.objects.duplicates(self) if dupes: raise ValidationError({ - 'address': "Duplicate IP address found in {}: {}".format( + 'address': "Duplicate IP Address found in {}: {}".format( "VRF {}".format(self.vrf) if self.vrf else "global table", dupes.first(), )