mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #35087 -- Reallowed filtering against foreign keys not listed in ModelAdmin.list_filters.
Regression in f80669d2f5
.
This commit is contained in:
parent
cc56c22a24
commit
a9094ec1f4
3 changed files with 20 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue