From 037792a2b5ba7c4c08de7e4bca023fe4124cde53 Mon Sep 17 00:00:00 2001 From: Sander Steffann Date: Fri, 9 Oct 2020 01:06:33 +0200 Subject: [PATCH] Fix updating from admin when subnet matches zone --- netbox_ddns/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox_ddns/admin.py b/netbox_ddns/admin.py index 0b17025..17fa839 100644 --- a/netbox_ddns/admin.py +++ b/netbox_ddns/admin.py @@ -127,9 +127,9 @@ class ReverseZoneAdmin(admin.ModelAdmin): 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 - 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: - 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: new_address = ip_address.address.ip