mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #35087 -- Reallowed filtering against foreign keys not listed in ModelAdmin.list_filters.
Regression in f80669d2f5.
This commit is contained in:
committed by
Mariusz Felisiak
parent
cc56c22a24
commit
a9094ec1f4
@@ -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