mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #7851: Add missing cluster name filter for virtual machines
This commit is contained in:
parent
f32e694499
commit
df9d67b873
@ -15,6 +15,7 @@
|
|||||||
* [#7729](https://github.com/netbox-community/netbox/issues/7729) - Fix permissions evaluation when displaying VLAN group VLANs table
|
* [#7729](https://github.com/netbox-community/netbox/issues/7729) - Fix permissions evaluation when displaying VLAN group VLANs table
|
||||||
* [#7739](https://github.com/netbox-community/netbox/issues/7739) - Fix exception when tracing cable across circuit with no far end termination
|
* [#7739](https://github.com/netbox-community/netbox/issues/7739) - Fix exception when tracing cable across circuit with no far end termination
|
||||||
* [#7813](https://github.com/netbox-community/netbox/issues/7813) - Fix handling of errors during export template rendering
|
* [#7813](https://github.com/netbox-community/netbox/issues/7813) - Fix handling of errors during export template rendering
|
||||||
|
* [#7851](https://github.com/netbox-community/netbox/issues/7851) - Add missing cluster name filter for virtual machines
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -144,6 +144,12 @@ class VirtualMachineFilterSet(PrimaryModelFilterSet, TenancyFilterSet, LocalConf
|
|||||||
queryset=Cluster.objects.all(),
|
queryset=Cluster.objects.all(),
|
||||||
label='Cluster (ID)',
|
label='Cluster (ID)',
|
||||||
)
|
)
|
||||||
|
cluster = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='cluster__name',
|
||||||
|
queryset=Cluster.objects.all(),
|
||||||
|
to_field_name='name',
|
||||||
|
label='Cluster',
|
||||||
|
)
|
||||||
region_id = TreeNodeMultipleChoiceFilter(
|
region_id = TreeNodeMultipleChoiceFilter(
|
||||||
queryset=Region.objects.all(),
|
queryset=Region.objects.all(),
|
||||||
field_name='cluster__site__region',
|
field_name='cluster__site__region',
|
||||||
|
@ -324,9 +324,8 @@ class VirtualMachineTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|||||||
clusters = Cluster.objects.all()[:2]
|
clusters = Cluster.objects.all()[:2]
|
||||||
params = {'cluster_id': [clusters[0].pk, clusters[1].pk]}
|
params = {'cluster_id': [clusters[0].pk, clusters[1].pk]}
|
||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||||
# TODO: 'cluster' should match on name
|
params = {'cluster': [clusters[0].name, clusters[1].name]}
|
||||||
# params = {'cluster': [clusters[0].name, clusters[1].name]}
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||||
# self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
|
||||||
|
|
||||||
def test_region(self):
|
def test_region(self):
|
||||||
regions = Region.objects.all()[:2]
|
regions = Region.objects.all()[:2]
|
||||||
|
Loading…
Reference in New Issue
Block a user