From abbc44a7d1e63e8d46148078ec3fc847ac07b962 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 10 Oct 2019 12:28:17 -0400 Subject: [PATCH] #3259: Add site and rack fields to cables filter form --- netbox/dcim/forms.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 3fa704d8d..66c98c022 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -3132,6 +3132,26 @@ class CableFilterForm(BootstrapMixin, forms.Form): required=False, label='Search' ) + site = FilterChoiceField( + queryset=Site.objects.all(), + to_field_name='slug', + widget=APISelectMultiple( + api_url="/api/dcim/sites/", + value_field="slug", + filter_for={ + 'rack_id': 'site', + } + ) + ) + rack_id = FilterChoiceField( + queryset=Rack.objects.all(), + label='Rack', + null_label='-- None --', + widget=APISelectMultiple( + api_url="/api/dcim/racks/", + null_option=True, + ) + ) type = forms.MultipleChoiceField( choices=add_blank_choice(CABLE_TYPE_CHOICES), required=False,