summaryrefslogtreecommitdiff
path: root/tests/modeladmin
diff options
context:
space:
mode:
authortschilling <schillingt@better-simple.com>2013-09-25 17:00:51 -0400
committerTim Graham <timograham@gmail.com>2013-10-02 09:13:59 -0400
commite5b0f5b95d49c33f5431cf4060705b5e59ec69d4 (patch)
treefe0b679cc239267ba5591fdc0c5aaae582848b87 /tests/modeladmin
parent4290cc1d6e3cbbb77d4098e15bd4db6c65ee904a (diff)
[1.6.x] Fixed #21129 -- Prevented admin filter params modifications from throwing an exception.
Thanks Tuttle for the report. Backport of 5381317fe3 from master
Diffstat (limited to 'tests/modeladmin')
-rw-r--r--tests/modeladmin/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 805b57c070..ffc6219ebb 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -88,6 +88,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.