From 5381317fe37d50384ef9a3bf3fb6b64ff4e9215c Mon Sep 17 00:00:00 2001 From: tschilling Date: Wed, 25 Sep 2013 17:00:51 -0400 Subject: Fixed #21129 -- Prevented admin filter params modifications from throwing an exception. Thanks Tuttle for the report. --- tests/modeladmin/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/modeladmin') diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index 930563f5ef..f7d78677c3 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -95,6 +95,18 @@ class ModelAdminTests(TestCase): form = ma.get_formset(None).form self.assertEqual(form._meta.fields, ['day', 'transport']) + def test_lookup_allowed_allows_nonexistent_lookup(self): + """ + Ensure that a lookup_allowed allows a parameter + whose field lookup doesn't exist. + Refs #21129. + """ + class BandAdmin(ModelAdmin): + fields = ['name'] + + ma = BandAdmin(Band, self.site) + self.assertTrue(ma.lookup_allowed('name__nonexistent', 'test_value')) + def test_field_arguments(self): # If we specify the fields argument, fieldsets_add and fielsets_change should # just stick the fields into a formsets structure and return it. -- cgit v1.3