diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-01-05 14:08:25 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-08 09:21:54 +0100 |
| commit | a9094ec1f43dca7f2a649327afcd5e6226b4959c (patch) | |
| tree | d56a57d3e6a610e27ee90d24d855814118d125bd /tests/modeladmin | |
| parent | cc56c22a24ef717cc3111e92ca146136fa518d55 (diff) | |
Fixed #35087 -- Reallowed filtering against foreign keys not listed in ModelAdmin.list_filters.
Regression in f80669d2f5a5f1db9e9b73ca893fefba34f955e7.
Diffstat (limited to 'tests/modeladmin')
| -rw-r--r-- | tests/modeladmin/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index e0c4d6e727..fad2dfaa1c 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -163,6 +163,20 @@ class ModelAdminTests(TestCase): ) @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): id = models.CharField(max_length=2, primary_key=True) |
