diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 71e5bc10f..0b9e2af0a 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -1809,7 +1809,7 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): # If editing an existing device, exclude it from the list of occupied rack units. This ensures that a device # can be flipped from one face to another. - self.fields['position'].widget.add_additional_query_param('exclude', self.instance.pk) + self.fields['position'].widget.add_query_param('exclude', self.instance.pk) # Limit platform by manufacturer self.fields['platform'].queryset = Platform.objects.filter( @@ -2673,8 +2673,8 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm): ) # Add current site to VLANs query params - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', device.site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', device.site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', device.site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', device.site.pk) class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm): @@ -2748,8 +2748,8 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm): ) # Add current site to VLANs query params - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', device.site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', device.site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', device.site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', device.site.pk) class InterfaceBulkCreateForm( @@ -2813,8 +2813,8 @@ class InterfaceBulkEditForm( ) # Add current site to VLANs query params - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', device.site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', device.site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', device.site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', device.site.pk) else: self.fields['lag'].choices = () self.fields['lag'].widget.attrs['disabled'] = True diff --git a/netbox/utilities/forms/fields.py b/netbox/utilities/forms/fields.py index fa5b86d7b..654c3b1b3 100644 --- a/netbox/utilities/forms/fields.py +++ b/netbox/utilities/forms/fields.py @@ -287,7 +287,7 @@ class DynamicModelChoiceMixin: # Attach any static query parameters for key, value in self.query_params.items(): - widget.add_additional_query_param(key, value) + widget.add_query_param(key, value) return attrs diff --git a/netbox/utilities/forms/widgets.py b/netbox/utilities/forms/widgets.py index fc4c83545..0ae7594ec 100644 --- a/netbox/utilities/forms/widgets.py +++ b/netbox/utilities/forms/widgets.py @@ -134,7 +134,7 @@ class APISelect(SelectWithDisabled): if full: self.attrs['data-full'] = full - def add_additional_query_param(self, name, value): + def add_query_param(self, name, value): """ Add details for an additional query param in the form of a data-* JSON-encoded list attribute. diff --git a/netbox/virtualization/forms.py b/netbox/virtualization/forms.py index c3b243978..f63f40d2b 100644 --- a/netbox/virtualization/forms.py +++ b/netbox/virtualization/forms.py @@ -572,8 +572,8 @@ class VMInterfaceForm(BootstrapMixin, forms.ModelForm): # Add current site to VLANs query params site = virtual_machine.site if site: - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', site.pk) def clean(self): super().clean() @@ -655,8 +655,8 @@ class VMInterfaceCreateForm(BootstrapMixin, forms.Form): # Add current site to VLANs query params site = virtual_machine.site if site: - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', site.pk) class VMInterfaceCSVForm(CSVModelForm): @@ -746,8 +746,8 @@ class VMInterfaceBulkEditForm(BootstrapMixin, BulkEditForm): site = getattr(parent_obj.cluster, 'site', None) if site is not None: # Add current site to VLANs query params - self.fields['untagged_vlan'].widget.add_additional_query_param('site_id', site.pk) - self.fields['tagged_vlans'].widget.add_additional_query_param('site_id', site.pk) + self.fields['untagged_vlan'].widget.add_query_param('site_id', site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', site.pk) class VMInterfaceBulkRenameForm(BulkRenameForm):