mirror of
https://github.com/drygdryg/netbox-plugin-device-map.git
synced 2024-11-26 12:10:54 +03:00
First pass at making VLAN optional
This commit is contained in:
parent
a10435e101
commit
242fe8e320
@ -15,6 +15,7 @@ class DeviceMapFilterForm(BootstrapMixin, forms.Form):
|
||||
)
|
||||
vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False,
|
||||
label="VLAN",
|
||||
help_text="Filter devices by VLAN attached to any device interface",
|
||||
query_params={"group_id": "$vlan_group"}
|
||||
|
@ -28,7 +28,7 @@ class MapView(PermissionRequiredMixin, View):
|
||||
interfaces = Interface.objects.all()
|
||||
vlan = form.cleaned_data['vlan']
|
||||
|
||||
interfaces = interfaces.filter(Q(untagged_vlan=vlan) | Q(tagged_vlans=vlan))
|
||||
#interfaces = interfaces.filter(Q(untagged_vlan=vlan) | Q(tagged_vlans=vlan))
|
||||
devices = Device.objects.filter(interfaces__in=interfaces).distinct()
|
||||
if device_roles := form.cleaned_data['device_roles']:
|
||||
devices = devices.filter(device_role__in=device_roles)
|
||||
|
Loading…
Reference in New Issue
Block a user