Jelajahi Sumber

Fixes #6910: Fix exception on invalid CSV import column name

jeremystretch 4 tahun lalu
induk
melakukan
7bcebd5b0f
2 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 1 0
      docs/release-notes/version-2.11.md
  2. 1 1
      netbox/netbox/views/generic.py

+ 1 - 0
docs/release-notes/version-2.11.md

@@ -12,6 +12,7 @@
 * [#6892](https://github.com/netbox-community/netbox/issues/6892) - Fix validation of unit ranges when creating a rack reservation
 * [#6892](https://github.com/netbox-community/netbox/issues/6892) - Fix validation of unit ranges when creating a rack reservation
 * [#6902](https://github.com/netbox-community/netbox/issues/6902) - Populate device field when cloning device components
 * [#6902](https://github.com/netbox-community/netbox/issues/6902) - Populate device field when cloning device components
 * [#6909](https://github.com/netbox-community/netbox/issues/6909) - Remove extraneous `site` column from VLAN group import form
 * [#6909](https://github.com/netbox-community/netbox/issues/6909) - Remove extraneous `site` column from VLAN group import form
+* [#6910](https://github.com/netbox-community/netbox/issues/6910) - Fix exception on invalid CSV import column name
 
 
 ---
 ---
 
 

+ 1 - 1
netbox/netbox/views/generic.py

@@ -675,7 +675,7 @@ class BulkImportView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
             )
             )
 
 
             def clean(self):
             def clean(self):
-                csv_rows = self.cleaned_data['csv'][1]
+                csv_rows = self.cleaned_data['csv'][1] if 'csv' in self.cleaned_data else None
                 csv_file = self.files.get('csv_file')
                 csv_file = self.files.get('csv_file')
 
 
                 # Check that the user has not submitted both text data and a file
                 # Check that the user has not submitted both text data and a file