浏览代码

Fixes #5718: Fix bulk editing of services when no port(s) are defined

Jeremy Stretch 5 年之前
父节点
当前提交
e3e928f1c4
共有 3 个文件被更改,包括 6 次插入2 次删除
  1. 1 0
      docs/release-notes/version-2.10.md
  2. 1 1
      netbox/netbox/views/generic.py
  3. 4 1
      netbox/utilities/forms/widgets.py

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

@@ -5,6 +5,7 @@
 ### Bug Fixes
 
 * [#5716](https://github.com/netbox-community/netbox/issues/5716) - Fix filtering rack reservations by custom field
+* [#5718](https://github.com/netbox-community/netbox/issues/5718) - Fix bulk editing of services when no port(s) are defined
 
 ---
 

+ 1 - 1
netbox/netbox/views/generic.py

@@ -792,7 +792,7 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
                                     if form.cleaned_data[name]:
                                         getattr(obj, name).set(form.cleaned_data[name])
                                 # Normal fields
-                                elif form.cleaned_data[name] not in (None, ''):
+                                elif form.cleaned_data[name] not in (None, '', []):
                                     setattr(obj, name, form.cleaned_data[name])
 
                             # Update custom fields

+ 4 - 1
netbox/utilities/forms/widgets.py

@@ -114,7 +114,10 @@ class ContentTypeSelect(StaticSelect2):
 class NumericArrayField(SimpleArrayField):
 
     def to_python(self, value):
-        value = ','.join([str(n) for n in parse_numeric_range(value)])
+        if not value:
+            return []
+        if isinstance(value, str):
+            value = ','.join([str(n) for n in parse_numeric_range(value)])
         return super().to_python(value)