mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Fix #12690 - Add Cluster/ClusterGroup Filtering to VLANGroup QuerySet
This commit is contained in:
parent
bf1c191b2e
commit
2038eb3ff6
@ -64,6 +64,16 @@ class VLANQuerySet(RestrictedQuerySet):
|
|||||||
scope_type=ContentType.objects.get_by_natural_key('dcim', 'rack'),
|
scope_type=ContentType.objects.get_by_natural_key('dcim', 'rack'),
|
||||||
scope_id=device.rack_id
|
scope_id=device.rack_id
|
||||||
)
|
)
|
||||||
|
if device.cluster:
|
||||||
|
q |= Q(
|
||||||
|
scope_type=ContentType.objects.get_by_natural_key('virtualization', 'cluster'),
|
||||||
|
scope_id=device.cluster.id
|
||||||
|
)
|
||||||
|
if device.cluster.group:
|
||||||
|
q |= Q(
|
||||||
|
scope_type=ContentType.objects.get_by_natural_key('virtualization', 'clustergroup'),
|
||||||
|
scope_id=device.cluster.group.id
|
||||||
|
)
|
||||||
|
|
||||||
# Return all applicable VLANs
|
# Return all applicable VLANs
|
||||||
return self.filter(
|
return self.filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user