Просмотр исходного кода

Fixes #4091: Fix filtering of objects by custom fields using UI search form

Jeremy Stretch 6 лет назад
Родитель
Сommit
68738e683a
2 измененных файлов с 3 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.7.md
  2. 2 1
      netbox/extras/forms.py

+ 1 - 0
docs/release-notes/version-2.7.md

@@ -3,6 +3,7 @@
 ## Bug Fixes
 
 * [#4089](https://github.com/netbox-community/netbox/issues/4089) - Selection of power outlet type during bulk update is optional
+* [#4091](https://github.com/netbox-community/netbox/issues/4091) - Fix filtering of objects by custom fields using UI search form
 
 # v2.7.4 (2020-02-04)
 

+ 2 - 1
netbox/extras/forms.py

@@ -133,7 +133,8 @@ class CustomFieldFilterForm(forms.Form):
             filter_logic=CustomFieldFilterLogicChoices.FILTER_DISABLED
         )
         for cf in custom_fields:
-            self.fields[cf.name] = cf.to_form_field(set_initial=True, enforce_required=False)
+            field_name = 'cf_{}'.format(cf.name)
+            self.fields[field_name] = cf.to_form_field(set_initial=True, enforce_required=False)
 
 
 #