mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
Misc cleanup
This commit is contained in:
parent
bdb5175316
commit
cce89a55fb
@ -1086,7 +1086,11 @@ class CustomFieldImportTest(TestCase):
|
|||||||
)
|
)
|
||||||
csv_data = '\n'.join(','.join(row) for row in data)
|
csv_data = '\n'.join(','.join(row) for row in data)
|
||||||
|
|
||||||
response = self.client.post(reverse('dcim:site_import'), {'data': csv_data, 'format': ImportFormatChoices.CSV, 'csv_delimiter': CSVDelimiterChoices.AUTO})
|
response = self.client.post(reverse('dcim:site_import'), {
|
||||||
|
'data': csv_data,
|
||||||
|
'format': ImportFormatChoices.CSV,
|
||||||
|
'csv_delimiter': CSVDelimiterChoices.AUTO,
|
||||||
|
})
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertEqual(Site.objects.count(), 3)
|
self.assertEqual(Site.objects.count(), 3)
|
||||||
|
|
||||||
|
@ -239,8 +239,8 @@ class CSVDelimiterChoices(ChoiceSet):
|
|||||||
TAB = '\t'
|
TAB = '\t'
|
||||||
|
|
||||||
CHOICES = [
|
CHOICES = [
|
||||||
(AUTO, 'Auto-detect'),
|
(AUTO, _('Auto-detect')),
|
||||||
(COMMA, 'Comma'),
|
(COMMA, _('Comma')),
|
||||||
(SEMICOLON, 'Semicolon'),
|
(SEMICOLON, _('Semicolon')),
|
||||||
(TAB, 'Tab'),
|
(TAB, _('Tab')),
|
||||||
]
|
]
|
||||||
|
@ -24,7 +24,7 @@ class BulkImportForm(BootstrapMixin, SyncedDataMixin, forms.Form):
|
|||||||
help_text=_("Enter object data in CSV, JSON or YAML format.")
|
help_text=_("Enter object data in CSV, JSON or YAML format.")
|
||||||
)
|
)
|
||||||
upload_file = forms.FileField(
|
upload_file = forms.FileField(
|
||||||
label="Data file",
|
label=_("Data file"),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
format = forms.ChoiceField(
|
format = forms.ChoiceField(
|
||||||
@ -34,7 +34,7 @@ class BulkImportForm(BootstrapMixin, SyncedDataMixin, forms.Form):
|
|||||||
csv_delimiter = forms.ChoiceField(
|
csv_delimiter = forms.ChoiceField(
|
||||||
choices=CSVDelimiterChoices,
|
choices=CSVDelimiterChoices,
|
||||||
initial=CSVDelimiterChoices.AUTO,
|
initial=CSVDelimiterChoices.AUTO,
|
||||||
label="CSV Delimiter",
|
label=_("CSV delimiter"),
|
||||||
help_text=_("The character which delimits CSV fields. Applies only to CSV format."),
|
help_text=_("The character which delimits CSV fields. Applies only to CSV format."),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user