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

Fixes #5081: Fix exception during webhook processing with custom select field

Jeremy Stretch 5 лет назад
Родитель
Сommit
967073eaaf
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.9.md
  2. 1 1
      netbox/extras/api/customfields.py

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

@@ -6,6 +6,7 @@
 
 * [#5063](https://github.com/netbox-community/netbox/issues/5063) - Fix "add device" link in rack elevations for opposite side of half-depth devices
 * [#5074](https://github.com/netbox-community/netbox/issues/5074) - Fix inclusion of VC member interfaces when viewing VC master
+* [#5081](https://github.com/netbox-community/netbox/issues/5081) - Fix exception during webhook processing with custom select field
 
 ---
 

+ 1 - 1
netbox/extras/api/customfields.py

@@ -158,7 +158,7 @@ class CustomFieldModelSerializer(ValidatedModelSerializer):
         instance.custom_fields = {}
         for field in custom_fields:
             value = instance.cf.get(field.name)
-            if field.type == CustomFieldTypeChoices.TYPE_SELECT and value is not None:
+            if field.type == CustomFieldTypeChoices.TYPE_SELECT and value:
                 instance.custom_fields[field.name] = CustomFieldChoiceSerializer(value).data
             else:
                 instance.custom_fields[field.name] = value