浏览代码

#3259: Add site and rack fields to cables filter form

Jeremy Stretch 6 年之前
父节点
当前提交
abbc44a7d1
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      netbox/dcim/forms.py

+ 20 - 0
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,