summaryrefslogtreecommitdiff
path: root/tests/modeladmin/tests.py
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-12 16:47:48 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-15 22:28:37 +0100
commit8081557508b197af975e0c6306d9b2af5e57d477 (patch)
treeb976df3af52926ed67bfd4448df8deb70b265fb1 /tests/modeladmin/tests.py
parent6b271ef21de31911f3ad7712341e3932936bd140 (diff)
Refs #22569 -- Made request required in ModelAdmin.lookup_allowed() per deprecation timeline.
Diffstat (limited to 'tests/modeladmin/tests.py')
-rw-r--r--tests/modeladmin/tests.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 062368d94e..00db6c19bc 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -275,36 +275,6 @@ class ModelAdminTests(TestCase):
True,
)
- def test_lookup_allowed_without_request_deprecation(self):
- class ConcertAdmin(ModelAdmin):
- list_filter = ["main_band__sign_date"]
-
- def get_list_filter(self, request):
- return self.list_filter + ["main_band__name"]
-
- def lookup_allowed(self, lookup, value):
- return True
-
- model_admin = ConcertAdmin(Concert, self.site)
- msg = (
- "`request` must be added to the signature of ModelAdminTests."
- "test_lookup_allowed_without_request_deprecation.<locals>."
- "ConcertAdmin.lookup_allowed()."
- )
- request_band_name_filter = RequestFactory().get(
- "/", {"main_band__name": "test"}
- )
- request_band_name_filter.user = User.objects.create_superuser(
- username="bob", email="bob@test.com", password="test"
- )
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
- changelist = model_admin.get_changelist_instance(request_band_name_filter)
- filterspec = changelist.get_filters(request_band_name_filter)[0][0]
- self.assertEqual(filterspec.title, "sign date")
- filterspec = changelist.get_filters(request_band_name_filter)[0][1]
- self.assertEqual(filterspec.title, "name")
- self.assertSequenceEqual(filterspec.lookup_choices, [self.band.name])
-
def test_field_arguments(self):
# If fields is specified, fieldsets_add and fieldsets_change should
# just stick the fields into a formsets structure and return it.