Skip to content

Commit

Permalink
Fixes #275: Exclude self when checking for overlapping aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jul 13, 2016
1 parent 03542b4 commit e19ce04
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions netbox/ipam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down

0 comments on commit e19ce04

Please sign in to comment.