Sfoglia il codice sorgente

Fix #12245 - Add WLAN to InterfaceBulkEditForm

Luke Anderson 2 anni fa
parent
commit
9d62174e1e
1 ha cambiato i file con 19 aggiunte e 3 eliminazioni
  1. 19 3
      netbox/dcim/forms/bulk_edit.py

+ 19 - 3
netbox/dcim/forms/bulk_edit.py

@@ -13,6 +13,7 @@ from tenancy.models import Tenant
 from utilities.forms import BulkEditForm, add_blank_choice, form_from_model
 from utilities.forms import BulkEditForm, add_blank_choice, form_from_model
 from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
 from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
 from utilities.forms.widgets import BulkEditNullBooleanSelect, NumberWithOptions
 from utilities.forms.widgets import BulkEditNullBooleanSelect, NumberWithOptions
+from wireless.models import WirelessLAN, WirelessLANGroup
 
 
 __all__ = (
 __all__ = (
     'CableBulkEditForm',
     'CableBulkEditForm',
@@ -1139,7 +1140,7 @@ class InterfaceBulkEditForm(
     form_from_model(Interface, [
     form_from_model(Interface, [
         'label', 'type', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'mtu', 'mgmt_only',
         'label', 'type', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'mtu', 'mgmt_only',
         'mark_connected', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width',
         'mark_connected', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width',
-        'tx_power',
+        'tx_power', 'wireless_lans'
     ]),
     ]),
     ComponentBulkEditForm
     ComponentBulkEditForm
 ):
 ):
@@ -1229,6 +1230,19 @@ class InterfaceBulkEditForm(
         required=False,
         required=False,
         label=_('VRF')
         label=_('VRF')
     )
     )
+    wireless_lan_group = DynamicModelChoiceField(
+        queryset=WirelessLANGroup.objects.all(),
+        required=False,
+        label=_('Wireless LAN group')
+    )
+    wireless_lans = DynamicModelMultipleChoiceField(
+        queryset=WirelessLAN.objects.all(),
+        required=False,
+        label=_('Wireless LANs'),
+        query_params={
+            'group_id': '$wireless_lan_group',
+        }
+    )
 
 
     model = Interface
     model = Interface
     fieldsets = (
     fieldsets = (
@@ -1238,12 +1252,14 @@ class InterfaceBulkEditForm(
         ('PoE', ('poe_mode', 'poe_type')),
         ('PoE', ('poe_mode', 'poe_type')),
         ('Related Interfaces', ('parent', 'bridge', 'lag')),
         ('Related Interfaces', ('parent', 'bridge', 'lag')),
         ('802.1Q Switching', ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
         ('802.1Q Switching', ('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans')),
-        ('Wireless', ('rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width')),
+        ('Wireless', (
+            'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'wireless_lan_group', 'wireless_lans',
+        )),
     )
     )
     nullable_fields = (
     nullable_fields = (
         'module', 'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'vdcs', 'mtu', 'description',
         'module', 'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'mac_address', 'wwn', 'vdcs', 'mtu', 'description',
         'poe_mode', 'poe_type', 'mode', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power',
         'poe_mode', 'poe_type', 'mode', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power',
-        'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf',
+        'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'wireless_lans'
     )
     )
 
 
     def __init__(self, *args, **kwargs):
     def __init__(self, *args, **kwargs):