Fix updating from admin when subnet matches zone

This commit is contained in:
Sander Steffann 2020-10-09 01:06:33 +02:00
parent 538d14b55d
commit 037792a2b5

View file

@ -127,9 +127,9 @@ class ReverseZoneAdmin(admin.ModelAdmin):
more_specifics = ReverseZone.objects.filter(prefix__net_contained=zone.prefix).exclude(pk=zone.pk) more_specifics = ReverseZone.objects.filter(prefix__net_contained=zone.prefix).exclude(pk=zone.pk)
# Find all IPAddress objects in this zone but not in the more-specifics # Find all IPAddress objects in this zone but not in the more-specifics
ip_addresses = IPAddress.objects.filter(address__net_contained=zone.prefix) ip_addresses = IPAddress.objects.filter(address__net_contained_or_equal=zone.prefix)
for more_specific in more_specifics: for more_specific in more_specifics:
ip_addresses = ip_addresses.exclude(address__net_contained=more_specific.prefix) ip_addresses = ip_addresses.exclude(address__net_contained_or_equal=more_specific.prefix)
for ip_address in ip_addresses: for ip_address in ip_addresses:
new_address = ip_address.address.ip new_address = ip_address.address.ip