-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.4.4
Python version
3.8
Steps to Reproduce
- Create Region with name = "Foo" and slug = "foo"
- Navigate to Site Bulk Import
- Populate Data with:
name,slug,status,region.slug
Bar,bar,active,foo
- Leave Format as Auto-detect
- Click Submit button
Expected Behavior
Site is created successfully under the Foo region.
Observed Behavior
A toast error message saying Record 1 region: Object not found: foo appears.
I believe this is due to this if statement being False, so the correct headers are never set:
netbox/netbox/netbox/views/generic/bulk_views.py
Lines 387 to 388 in 93ac0b7
| if form.cleaned_data['format'] == ImportFormatChoices.CSV: | |
| model_form_kwargs['headers'] = form._csv_headers |
When the format is auto-detected here:
netbox/netbox/utilities/forms/forms.py
Lines 187 to 191 in 93685d9
| # Determine the data format | |
| if self.cleaned_data['format'] == ImportFormatChoices.AUTO: | |
| format = self._detect_format(data) | |
| else: | |
| format = self.cleaned_data['format'] |
The value for form.cleaned_data['format'] is never updated to reflect the auto-detected format, so it is still ImportFormatChoices.AUTO when checked in the view.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application