mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #35173 -- Fixed ModelAdmin.lookup_allowed() for lookups on foreign keys when not included in ModelAdmin.list_filter.
Regression in f80669d2f5
.
Thanks Sarah Boyce for the review.
This commit is contained in:
parent
c783e7a3a0
commit
8db593de05
3 changed files with 30 additions and 12 deletions
|
@ -174,7 +174,19 @@ class ModelAdminTests(TestCase):
|
|||
pass
|
||||
|
||||
ma = PlaceAdmin(Place, self.site)
|
||||
self.assertIs(ma.lookup_allowed("country", "1", request), True)
|
||||
|
||||
cases = [
|
||||
("country", "1"),
|
||||
("country__exact", "1"),
|
||||
("country__id", "1"),
|
||||
("country__id__exact", "1"),
|
||||
("country__isnull", True),
|
||||
("country__isnull", False),
|
||||
("country__id__isnull", False),
|
||||
]
|
||||
for lookup, lookup_value in cases:
|
||||
with self.subTest(lookup=lookup):
|
||||
self.assertIs(ma.lookup_allowed(lookup, lookup_value, request), True)
|
||||
|
||||
@isolate_apps("modeladmin")
|
||||
def test_lookup_allowed_non_autofield_primary_key(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue