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

This commit is contained in:
Jeremy Stretch 2021-02-04 13:01:55 -05:00
parent e155acbbd4
commit e3e928f1c4
3 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@
### Bug Fixes ### Bug Fixes
* [#5716](https://github.com/netbox-community/netbox/issues/5716) - Fix filtering rack reservations by custom field * [#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
--- ---

View File

@ -792,7 +792,7 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
if form.cleaned_data[name]: if form.cleaned_data[name]:
getattr(obj, name).set(form.cleaned_data[name]) getattr(obj, name).set(form.cleaned_data[name])
# Normal fields # 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]) setattr(obj, name, form.cleaned_data[name])
# Update custom fields # Update custom fields

View File

@ -114,7 +114,10 @@ class ContentTypeSelect(StaticSelect2):
class NumericArrayField(SimpleArrayField): class NumericArrayField(SimpleArrayField):
def to_python(self, value): 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) return super().to_python(value)