mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[5.0.x] Fixed #35087 -- Reallowed filtering against foreign keys not listed in ModelAdmin.list_filters.
Regression inf80669d2f5. Backport ofa9094ec1f4from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
4818a139f7
commit
4cba6748a6
@@ -162,6 +162,20 @@ class ModelAdminTests(TestCase):
|
||||
True,
|
||||
)
|
||||
|
||||
@isolate_apps("modeladmin")
|
||||
def test_lookup_allowed_for_local_fk_fields(self):
|
||||
class Country(models.Model):
|
||||
pass
|
||||
|
||||
class Place(models.Model):
|
||||
country = models.ForeignKey(Country, models.CASCADE)
|
||||
|
||||
class PlaceAdmin(ModelAdmin):
|
||||
pass
|
||||
|
||||
ma = PlaceAdmin(Place, self.site)
|
||||
self.assertIs(ma.lookup_allowed("country", "1", request), True)
|
||||
|
||||
@isolate_apps("modeladmin")
|
||||
def test_lookup_allowed_non_autofield_primary_key(self):
|
||||
class Country(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user