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
This commit is contained in:

committed by
Jeremy Stretch

parent
fb004bb94e
commit
31644b4ce6
@@ -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)
|
||||
)
|
||||
|
||||
|
@@ -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']
|
||||
|
||||
|
Reference in New Issue
Block a user