diff --git a/netbox/ipam/models.py b/netbox/ipam/models.py index 402e023300f..e37e21bb3ef 100644 --- a/netbox/ipam/models.py +++ b/netbox/ipam/models.py @@ -123,6 +123,8 @@ def clean(self): # Ensure that the aggregate being added does not cover an existing aggregate covered_aggregates = Aggregate.objects.filter(prefix__net_contained=str(self.prefix)) + if self.pk: + covered_aggregates = covered_aggregates.exclude(pk=self.pk) if covered_aggregates: raise ValidationError("{} is overlaps with an existing aggregate ({})" .format(self.prefix, covered_aggregates[0]))