From 31644b4ce66a437cd4de2d1a40c5b4c2d9177775 Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Sun, 14 Sep 2025 19:23:27 +0200 Subject: [PATCH] fix(ipam): Remove FHRP IP prefix constraint Remove `FHRPGroupAssignmentForm.__init__` logic that tied group choices to the interface IP prefix. Add `group_id` to the `q` filter to enable matching by group ID. Fixes #19262 --- netbox/ipam/filtersets.py | 1 + netbox/ipam/forms/model_forms.py | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/netbox/ipam/filtersets.py b/netbox/ipam/filtersets.py index 7f8cd2f04..cf4f99d32 100644 --- a/netbox/ipam/filtersets.py +++ b/netbox/ipam/filtersets.py @@ -804,6 +804,7 @@ class FHRPGroupFilterSet(NetBoxModelFilterSet): return queryset return queryset.filter( Q(description__icontains=value) | + Q(group_id__contains=value) | Q(name__icontains=value) ) diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index 1b4a3d596..399198c52 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -580,13 +580,6 @@ class FHRPGroupAssignmentForm(forms.ModelForm): model = FHRPGroupAssignment fields = ('group', 'priority') - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - ipaddresses = self.instance.interface.ip_addresses.all() - for ipaddress in ipaddresses: - self.fields['group'].widget.add_query_param('related_ip', ipaddress.pk) - def clean_group(self): group = self.cleaned_data['group']