jeremystretch 2 лет назад
Родитель
Сommit
ef7c66de34
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      netbox/utilities/forms/bulk_import.py

+ 3 - 2
netbox/utilities/forms/bulk_import.py

@@ -15,7 +15,8 @@ from .forms import BootstrapMixin
 
 class ImportForm(BootstrapMixin, SyncedDataMixin, forms.Form):
     import_method = forms.ChoiceField(
-        choices=ImportMethodChoices
+        choices=ImportMethodChoices,
+        required=False
     )
     data = forms.CharField(
         required=False,
@@ -37,7 +38,7 @@ class ImportForm(BootstrapMixin, SyncedDataMixin, forms.Form):
         super().clean()
 
         # Determine import method
-        import_method = self.cleaned_data['import_method']
+        import_method = self.cleaned_data.get('import_method') or ImportMethodChoices.DIRECT
 
         # Determine whether we're reading from form data or an uploaded file
         if self.cleaned_data['data'] and import_method != ImportMethodChoices.DIRECT: