Просмотр исходного кода

Rename add_additional_query_param()

Jeremy Stretch 5 лет назад
Родитель
Сommit
c40df97ffa

+ 7 - 7
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
             # 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.
             # 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
             # Limit platform by manufacturer
             self.fields['platform'].queryset = Platform.objects.filter(
             self.fields['platform'].queryset = Platform.objects.filter(
@@ -2673,8 +2673,8 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm):
         )
         )
 
 
         # Add current site to VLANs query params
         # 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):
 class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
@@ -2748,8 +2748,8 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
         )
         )
 
 
         # Add current site to VLANs query params
         # 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(
 class InterfaceBulkCreateForm(
@@ -2813,8 +2813,8 @@ class InterfaceBulkEditForm(
             )
             )
 
 
             # Add current site to VLANs query params
             # 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:
         else:
             self.fields['lag'].choices = ()
             self.fields['lag'].choices = ()
             self.fields['lag'].widget.attrs['disabled'] = True
             self.fields['lag'].widget.attrs['disabled'] = True

+ 1 - 1
netbox/utilities/forms/fields.py

@@ -287,7 +287,7 @@ class DynamicModelChoiceMixin:
 
 
         # Attach any static query parameters
         # Attach any static query parameters
         for key, value in self.query_params.items():
         for key, value in self.query_params.items():
-            widget.add_additional_query_param(key, value)
+            widget.add_query_param(key, value)
 
 
         return attrs
         return attrs
 
 

+ 1 - 1
netbox/utilities/forms/widgets.py

@@ -134,7 +134,7 @@ class APISelect(SelectWithDisabled):
         if full:
         if full:
             self.attrs['data-full'] = 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.
         Add details for an additional query param in the form of a data-* JSON-encoded list attribute.
 
 

+ 6 - 6
netbox/virtualization/forms.py

@@ -572,8 +572,8 @@ class VMInterfaceForm(BootstrapMixin, forms.ModelForm):
         # Add current site to VLANs query params
         # Add current site to VLANs query params
         site = virtual_machine.site
         site = virtual_machine.site
         if 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):
     def clean(self):
         super().clean()
         super().clean()
@@ -655,8 +655,8 @@ class VMInterfaceCreateForm(BootstrapMixin, forms.Form):
         # Add current site to VLANs query params
         # Add current site to VLANs query params
         site = virtual_machine.site
         site = virtual_machine.site
         if 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):
 class VMInterfaceCSVForm(CSVModelForm):
@@ -746,8 +746,8 @@ class VMInterfaceBulkEditForm(BootstrapMixin, BulkEditForm):
             site = getattr(parent_obj.cluster, 'site', None)
             site = getattr(parent_obj.cluster, 'site', None)
             if site is not None:
             if site is not None:
                 # Add current site to VLANs query params
                 # 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):
 class VMInterfaceBulkRenameForm(BulkRenameForm):