From 85c06372ffe04f0fbb4ac6c05394bc1f819785d0 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 5 Jan 2022 21:04:44 -0500 Subject: [PATCH] Fix bulk editing for custom object fields --- netbox/netbox/views/generic/bulk_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py index 6f21a6879..d76bc598d 100644 --- a/netbox/netbox/views/generic/bulk_views.py +++ b/netbox/netbox/views/generic/bulk_views.py @@ -285,7 +285,7 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View): return get_permission_for_model(self.queryset.model, 'change') def _update_objects(self, form, request): - custom_fields = form.custom_fields if hasattr(form, 'custom_fields') else [] + custom_fields = getattr(form, 'custom_fields', []) standard_fields = [ field for field in form.fields if field not in custom_fields + ['pk'] ] @@ -327,7 +327,7 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View): if name in form.nullable_fields and name in nullified_fields: obj.custom_field_data[name] = None elif name in form.changed_data: - obj.custom_field_data[name] = form.cleaned_data[name] + obj.custom_field_data[name] = form.fields[name].prepare_value(form.cleaned_data[name]) obj.full_clean() obj.save()