mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-15 19:52:52 -06:00
Fixes #11683: Fix CSV header attribute detection when auto-detecting import format
This commit is contained in:
parent
3f28d6aef3
commit
56c7a238a4
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## v3.4.5 (FUTURE)
|
## v3.4.5 (FUTURE)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#11683](https://github.com/netbox-community/netbox/issues/11683) - Fix CSV header attribute detection when auto-detecting import format
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## v3.4.4 (2023-02-02)
|
## v3.4.4 (2023-02-02)
|
||||||
|
@ -384,8 +384,8 @@ class BulkImportView(GetReturnURLMixin, BaseMultiObjectView):
|
|||||||
'data': record,
|
'data': record,
|
||||||
'instance': instance,
|
'instance': instance,
|
||||||
}
|
}
|
||||||
if form.cleaned_data['format'] == ImportFormatChoices.CSV:
|
if hasattr(form, '_csv_headers'):
|
||||||
model_form_kwargs['headers'] = form._csv_headers
|
model_form_kwargs['headers'] = form._csv_headers # Add CSV headers
|
||||||
model_form = self.model_form(**model_form_kwargs)
|
model_form = self.model_form(**model_form_kwargs)
|
||||||
|
|
||||||
# When updating, omit all form fields other than those specified in the record. (No
|
# When updating, omit all form fields other than those specified in the record. (No
|
||||||
|
@ -197,6 +197,8 @@ class ImportForm(BootstrapMixin, forms.Form):
|
|||||||
self.cleaned_data['data'] = self._clean_json(data)
|
self.cleaned_data['data'] = self._clean_json(data)
|
||||||
elif format == ImportFormatChoices.YAML:
|
elif format == ImportFormatChoices.YAML:
|
||||||
self.cleaned_data['data'] = self._clean_yaml(data)
|
self.cleaned_data['data'] = self._clean_yaml(data)
|
||||||
|
else:
|
||||||
|
raise forms.ValidationError(f"Unknown data format: {format}")
|
||||||
|
|
||||||
def _detect_format(self, data):
|
def _detect_format(self, data):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user