Skip to content

Commit

Permalink
Closes #17752: Rename URL paths for bulk import to *_bulk_import
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Nov 22, 2024
1 parent 343a4af commit ff7a59d
Show file tree
Hide file tree
Showing 23 changed files with 141 additions and 141 deletions.
8 changes: 4 additions & 4 deletions netbox/circuits/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ def test_bulk_import_objects_with_terminations(self):
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))

# Try GET with model-level permission
self.assertHttpStatus(self.client.get(self._get_url('import')), 200)
self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200)

# Test POST with permission
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302)
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302)
self.assertEqual(self._get_queryset().count(), initial_count + 1)


Expand Down Expand Up @@ -655,10 +655,10 @@ def test_bulk_import_objects_with_terminations(self):
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))

# Try GET with model-level permission
self.assertHttpStatus(self.client.get(self._get_url('import')), 200)
self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200)

# Test POST with permission
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302)
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302)
self.assertEqual(self._get_queryset().count(), initial_count + 1)


Expand Down
4 changes: 2 additions & 2 deletions netbox/circuits/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Virtual circuits
path('virtual-circuits/', views.VirtualCircuitListView.as_view(), name='virtualcircuit_list'),
path('virtual-circuits/add/', views.VirtualCircuitEditView.as_view(), name='virtualcircuit_add'),
path('virtual-circuits/import/', views.VirtualCircuitBulkImportView.as_view(), name='virtualcircuit_import'),
path('virtual-circuits/import/', views.VirtualCircuitBulkImportView.as_view(), name='virtualcircuit_bulk_import'),
path('virtual-circuits/edit/', views.VirtualCircuitBulkEditView.as_view(), name='virtualcircuit_bulk_edit'),
path('virtual-circuits/delete/', views.VirtualCircuitBulkDeleteView.as_view(), name='virtualcircuit_bulk_delete'),
path('virtual-circuits/<int:pk>/', include(get_model_urls('circuits', 'virtualcircuit'))),
Expand All @@ -56,7 +56,7 @@
path(
'virtual-circuit-terminations/import/',
views.VirtualCircuitTerminationBulkImportView.as_view(),
name='virtualcircuittermination_import',
name='virtualcircuittermination_bulk_import',
),
path(
'virtual-circuit-terminations/edit/',
Expand Down
16 changes: 8 additions & 8 deletions netbox/circuits/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ProviderDeleteView(generic.ObjectDeleteView):
queryset = Provider.objects.all()


@register_model_view(Provider, 'import', detail=False)
@register_model_view(Provider, 'bulk_import', detail=False)
class ProviderBulkImportView(generic.BulkImportView):
queryset = Provider.objects.all()
model_form = forms.ProviderImportForm
Expand Down Expand Up @@ -115,7 +115,7 @@ class ProviderAccountDeleteView(generic.ObjectDeleteView):
queryset = ProviderAccount.objects.all()


@register_model_view(ProviderAccount, 'import', detail=False)
@register_model_view(ProviderAccount, 'bulk_import', detail=False)
class ProviderAccountBulkImportView(generic.BulkImportView):
queryset = ProviderAccount.objects.all()
model_form = forms.ProviderAccountImportForm
Expand Down Expand Up @@ -189,7 +189,7 @@ class ProviderNetworkDeleteView(generic.ObjectDeleteView):
queryset = ProviderNetwork.objects.all()


@register_model_view(ProviderNetwork, 'import', detail=False)
@register_model_view(ProviderNetwork, 'bulk_import', detail=False)
class ProviderNetworkBulkImportView(generic.BulkImportView):
queryset = ProviderNetwork.objects.all()
model_form = forms.ProviderNetworkImportForm
Expand Down Expand Up @@ -246,7 +246,7 @@ class CircuitTypeDeleteView(generic.ObjectDeleteView):
queryset = CircuitType.objects.all()


@register_model_view(CircuitType, 'import', detail=False)
@register_model_view(CircuitType, 'bulk_import', detail=False)
class CircuitTypeBulkImportView(generic.BulkImportView):
queryset = CircuitType.objects.all()
model_form = forms.CircuitTypeImportForm
Expand Down Expand Up @@ -302,7 +302,7 @@ class CircuitDeleteView(generic.ObjectDeleteView):
queryset = Circuit.objects.all()


@register_model_view(Circuit, 'import', detail=False)
@register_model_view(Circuit, 'bulk_import', detail=False)
class CircuitBulkImportView(generic.BulkImportView):
queryset = Circuit.objects.all()
model_form = forms.CircuitImportForm
Expand Down Expand Up @@ -447,7 +447,7 @@ class CircuitTerminationDeleteView(generic.ObjectDeleteView):
queryset = CircuitTermination.objects.all()


@register_model_view(CircuitTermination, 'import', detail=False)
@register_model_view(CircuitTermination, 'bulk_import', detail=False)
class CircuitTerminationBulkImportView(generic.BulkImportView):
queryset = CircuitTermination.objects.all()
model_form = forms.CircuitTerminationImportForm
Expand Down Expand Up @@ -508,7 +508,7 @@ class CircuitGroupDeleteView(generic.ObjectDeleteView):
queryset = CircuitGroup.objects.all()


@register_model_view(CircuitGroup, 'import', detail=False)
@register_model_view(CircuitGroup, 'bulk_import', detail=False)
class CircuitGroupBulkImportView(generic.BulkImportView):
queryset = CircuitGroup.objects.all()
model_form = forms.CircuitGroupImportForm
Expand Down Expand Up @@ -558,7 +558,7 @@ class CircuitGroupAssignmentDeleteView(generic.ObjectDeleteView):
queryset = CircuitGroupAssignment.objects.all()


@register_model_view(CircuitGroupAssignment, 'import', detail=False)
@register_model_view(CircuitGroupAssignment, 'bulk_import', detail=False)
class CircuitGroupAssignmentBulkImportView(generic.BulkImportView):
queryset = CircuitGroupAssignment.objects.all()
model_form = forms.CircuitGroupAssignmentImportForm
Expand Down
2 changes: 1 addition & 1 deletion netbox/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class DataSourceDeleteView(generic.ObjectDeleteView):
queryset = DataSource.objects.all()


@register_model_view(DataSource, 'import', detail=False)
@register_model_view(DataSource, 'bulk_import', detail=False)
class DataSourceBulkImportView(generic.BulkImportView):
queryset = DataSource.objects.all()
model_form = forms.DataSourceImportForm
Expand Down
10 changes: 5 additions & 5 deletions netbox/dcim/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ def test_import_objects(self):
'data': IMPORT_DATA,
'format': 'yaml'
}
response = self.client.post(reverse('dcim:devicetype_import'), data=form_data, follow=True)
response = self.client.post(reverse('dcim:devicetype_bulk_import'), data=form_data, follow=True)
self.assertHttpStatus(response, 200)

device_type = DeviceType.objects.get(model='TEST-1000')
Expand Down Expand Up @@ -1228,7 +1228,7 @@ def test_import_objects(self):
'data': IMPORT_DATA,
'format': 'yaml'
}
response = self.client.post(reverse('dcim:moduletype_import'), data=form_data, follow=True)
response = self.client.post(reverse('dcim:moduletype_bulk_import'), data=form_data, follow=True)
self.assertHttpStatus(response, 200)

module_type = ModuleType.objects.get(model='TEST-1000')
Expand Down Expand Up @@ -2170,7 +2170,7 @@ def test_module_bulk_replication(self):
f"{device.name},{module_bay.name},{module_type.model},active,false"
]
request = {
'path': self._get_url('import'),
'path': self._get_url('bulk_import'),
'data': {
'data': '\n'.join(csv_data),
'format': ImportFormatChoices.CSV,
Expand All @@ -2187,7 +2187,7 @@ def test_module_bulk_replication(self):
module_bay = ModuleBay.objects.get(device=device, name='Module Bay 5')
csv_data[1] = f"{device.name},{module_bay.name},{module_type.model},active,true"
request = {
'path': self._get_url('import'),
'path': self._get_url('bulk_import'),
'data': {
'data': '\n'.join(csv_data),
'format': ImportFormatChoices.CSV,
Expand Down Expand Up @@ -2264,7 +2264,7 @@ def test_module_bulk_adoption(self):
f"{device.name},{module_bay.name},{module_type.model},active,false,true"
]
request = {
'path': self._get_url('import'),
'path': self._get_url('bulk_import'),
'data': {
'data': '\n'.join(csv_data),
'format': ImportFormatChoices.CSV,
Expand Down
Loading

0 comments on commit ff7a59d

Please sign in to comment.