From e1dba2dbcf8d2f0efeea8f066d28493c06226674 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Wed, 8 Nov 2023 22:39:36 +0530 Subject: [PATCH 1/2] adds device and vm to service filter form #13951 --- netbox/ipam/forms/filtersets.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/netbox/ipam/forms/filtersets.py b/netbox/ipam/forms/filtersets.py index aae62ca7575..fa54b592e15 100644 --- a/netbox/ipam/forms/filtersets.py +++ b/netbox/ipam/forms/filtersets.py @@ -523,6 +523,21 @@ class ServiceTemplateFilterForm(NetBoxModelFilterSetForm): class ServiceFilterForm(ServiceTemplateFilterForm): model = Service + fieldsets = ( + (None, ('q', 'filter_id', 'tag')), + (_('Attributes'), ('protocol', 'port')), + (_('Device/VM'), ('device_id', 'virtual_machine_id')), + ) + device_id = DynamicModelMultipleChoiceField( + queryset=Device.objects.all(), + required=False, + label=_('Assigned Device'), + ) + virtual_machine_id = DynamicModelMultipleChoiceField( + queryset=VirtualMachine.objects.all(), + required=False, + label=_('Assigned VM'), + ) tag = TagFilterField(model) From 79a20800e796bfc4ceaa83773caa09bd16cd303a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 9 Nov 2023 08:44:25 -0500 Subject: [PATCH 2/2] Tweak labels --- netbox/ipam/forms/filtersets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox/ipam/forms/filtersets.py b/netbox/ipam/forms/filtersets.py index fa54b592e15..a8ca91901d3 100644 --- a/netbox/ipam/forms/filtersets.py +++ b/netbox/ipam/forms/filtersets.py @@ -526,17 +526,17 @@ class ServiceFilterForm(ServiceTemplateFilterForm): fieldsets = ( (None, ('q', 'filter_id', 'tag')), (_('Attributes'), ('protocol', 'port')), - (_('Device/VM'), ('device_id', 'virtual_machine_id')), + (_('Assignment'), ('device_id', 'virtual_machine_id')), ) device_id = DynamicModelMultipleChoiceField( queryset=Device.objects.all(), required=False, - label=_('Assigned Device'), + label=_('Device'), ) virtual_machine_id = DynamicModelMultipleChoiceField( queryset=VirtualMachine.objects.all(), required=False, - label=_('Assigned VM'), + label=_('Virtual Machine'), ) tag = TagFilterField(model)