mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 11:38:45 -06:00
Fixes #18605: only VLANs at selected Site are shown in VLAN select
This commit is contained in:
@@ -212,7 +212,7 @@ class PrefixForm(TenancyForm, ScopedForm, NetBoxModelForm):
|
||||
required=False,
|
||||
selector=True,
|
||||
query_params={
|
||||
'available_at_site': '$site',
|
||||
'available_at_site': '$scope',
|
||||
},
|
||||
label=_('VLAN'),
|
||||
)
|
||||
@@ -240,6 +240,14 @@ class PrefixForm(TenancyForm, ScopedForm, NetBoxModelForm):
|
||||
'tenant', 'description', 'comments', 'tags',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# #18605: only filter VLAN select list if scope field is a Site
|
||||
if scope_field := self.fields.get('scope', None):
|
||||
if scope_field.queryset.model is not Site:
|
||||
self.fields['vlan'].widget.attrs.pop('data-dynamic-params', None)
|
||||
|
||||
|
||||
class IPRangeForm(TenancyForm, NetBoxModelForm):
|
||||
vrf = DynamicModelChoiceField(
|
||||
|
||||
Reference in New Issue
Block a user