mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Closes #11619: Include VLANs with a null site in query during bulk interface edit for Devices > DEVICE COMPONENTS > Interfaces (#12659)
* Closes #11619: Allow VLANs without a site during multi-port edits This commit allows users to be able to select VLANs without a site assignment during bulk interfaces edits under Devices > DEVICE COMPONENTS > Interfaces. Prior to this commit, only VLANs that were assigned the same site as the device were available for selection. * Replace 'null' with FILTERS_NULL_CHOICE_VALUE constant --------- Co-authored-by: jeremystretch <jstretch@netboxlabs.com>
This commit is contained in:
parent
80fc8db514
commit
078893e034
@ -1,4 +1,5 @@
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import gettext as _
|
||||
from timezone_field import TimeZoneFormField
|
||||
@ -1292,8 +1293,13 @@ class InterfaceBulkEditForm(
|
||||
break
|
||||
|
||||
if site is not None:
|
||||
self.fields['untagged_vlan'].widget.add_query_param('site_id', site.pk)
|
||||
self.fields['tagged_vlans'].widget.add_query_param('site_id', site.pk)
|
||||
# Query for VLANs assigned to the same site and VLANs with no site assigned (null).
|
||||
self.fields['untagged_vlan'].widget.add_query_param(
|
||||
'site_id', [site.pk, settings.FILTERS_NULL_CHOICE_VALUE]
|
||||
)
|
||||
self.fields['tagged_vlans'].widget.add_query_param(
|
||||
'site_id', [site.pk, settings.FILTERS_NULL_CHOICE_VALUE]
|
||||
)
|
||||
|
||||
self.fields['parent'].choices = ()
|
||||
self.fields['parent'].widget.attrs['disabled'] = True
|
||||
|
Loading…
Reference in New Issue
Block a user