From ad78f9e0752080fdea9d0465bb3d5cd7ecb64b55 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 12 Dec 2022 14:19:27 -0500 Subject: [PATCH] #7961: Fix updating via import when custom fields are absent --- netbox/netbox/forms/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/netbox/forms/base.py b/netbox/netbox/forms/base.py index 20a3793da..f3936816c 100644 --- a/netbox/netbox/forms/base.py +++ b/netbox/netbox/forms/base.py @@ -48,6 +48,9 @@ class NetBoxModelForm(BootstrapMixin, CustomFieldsMixin, forms.ModelForm): # Save custom field data on instance for cf_name, customfield in self.custom_fields.items(): + if cf_name not in self.fields: + # Custom fields may be absent when performing bulk updates via import + continue key = cf_name[3:] # Strip "cf_" from field name value = self.cleaned_data.get(cf_name)