mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-23 21:57:47 -06:00
Fixes #67: Improved Aggregate validation; extended aggregate documentation
This commit is contained in:
@@ -121,6 +121,12 @@ class Aggregate(CreatedUpdatedModel):
|
||||
raise ValidationError("{} is already covered by an existing aggregate ({})"
|
||||
.format(self.prefix, covering_aggregates[0]))
|
||||
|
||||
# Ensure that the aggregate being added does not cover an existing aggregate
|
||||
covered_aggregates = Aggregate.objects.filter(prefix__net_contained=str(self.prefix))
|
||||
if covered_aggregates:
|
||||
raise ValidationError("{} is overlaps with an existing aggregate ({})"
|
||||
.format(self.prefix, covered_aggregates[0]))
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.prefix:
|
||||
# Infer address family from IPNetwork object
|
||||
|
||||
Reference in New Issue
Block a user