From 6140dd955ae5162f33459a4d90debf02246c8f0d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 6 Nov 2018 12:12:01 -0500 Subject: [PATCH] Set unit_length to empty string when not specified during cable import --- netbox/dcim/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 04e2120e6..8e0ab5a99 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -1969,6 +1969,11 @@ class CableCSVForm(forms.ModelForm): self.instance.termination_b = termination_object return termination_object + def clean_length_unit(self): + # Avoid trying to save as NULL + length_unit = self.cleaned_data.get('length_unit', None) + return length_unit if length_unit is not None else '' + class CableBulkEditForm(BootstrapMixin, BulkEditForm): pk = forms.ModelMultipleChoiceField(