mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Strip whitespace from csv headers
This commit is contained in:
parent
ab303db3dd
commit
d75f2da720
@ -226,6 +226,10 @@ class ImportForm(BootstrapMixin, forms.Form):
|
||||
reader = csv.reader(stream)
|
||||
headers, records = parse_csv(reader)
|
||||
|
||||
# Strip whitespace from headers
|
||||
headers = {k.strip(): v for k, v in headers.items()}
|
||||
records = [{k.strip(): v for k, v in record.items()} for record in records]
|
||||
|
||||
# Set CSV headers for reference by the model form
|
||||
self._csv_headers = headers
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user