Closes #17752: Rename URL paths for bulk import to *_bulk_import

This commit is contained in:
Jeremy Stretch
2024-11-21 16:01:31 -05:00
parent 343a4af591
commit ff7a59db2e
23 changed files with 141 additions and 141 deletions

View File

@@ -158,7 +158,7 @@ def add_button(model, action='add'):
@register.inclusion_tag('buttons/import.html')
def import_button(model, action='import'):
def import_button(model, action='bulk_import'):
try:
url = reverse(get_viewname(model, action))
except NoReverseMatch:

View File

@@ -594,10 +594,10 @@ class ViewTestCases:
# Test GET without permission
with disable_warnings('django.request'):
self.assertHttpStatus(self.client.get(self._get_url('import')), 403)
self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 403)
# Try POST without permission
response = self.client.post(self._get_url('import'), data)
response = self.client.post(self._get_url('bulk_import'), data)
with disable_warnings('django.request'):
self.assertHttpStatus(response, 403)
@@ -620,10 +620,10 @@ class ViewTestCases:
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 + len(self.csv_data) - 1)
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
@@ -649,7 +649,7 @@ class ViewTestCases:
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))
# 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(initial_count, self._get_queryset().count())
reader = csv.DictReader(array, delimiter=',')
@@ -684,7 +684,7 @@ class ViewTestCases:
obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model))
# Attempt to import non-permitted objects
self.assertHttpStatus(self.client.post(self._get_url('import'), data), 200)
self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 200)
self.assertEqual(self._get_queryset().count(), initial_count)
# Update permission constraints
@@ -692,7 +692,7 @@ class ViewTestCases:
obj_perm.save()
# Import permitted objects
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 + len(self.csv_data) - 1)
class BulkEditObjectsViewTestCase(ModelViewTestCase):