diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-01-28 14:08:25 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-01-28 14:08:25 +0000 |
| commit | c24bdf044ba23f2aa09ea4637a368ea86fd1c128 (patch) | |
| tree | 9e9afcb8dc6803205570e5e047539537528b9ea8 /tests/regressiontests/admin_views/tests.py | |
| parent | 22eaf77f9d3541e007d3e1b6292710bb6a016dff (diff) | |
Fixed #15103 - SuspiciousOperation with limit_choices_to and raw_id_fields
Thanks to natrius for the report.
This patch also fixes some unicode bugs in affected code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views/tests.py')
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 661954c7ec..30e8c2f8e0 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -393,6 +393,17 @@ class AdminViewBasicTest(TestCase): response = self.client.get("/test_admin/admin/admin_views/workhour/?employee__person_ptr__exact=%d" % e1.pk) self.assertEqual(response.status_code, 200) + def test_allowed_filtering_15103(self): + """ + Regressions test for ticket 15103 - filtering on fields defined in a + ForeignKey 'limit_choices_to' should be allowed, otherwise raw_id_fields + can break. + """ + try: + self.client.get("/test_admin/admin/admin_views/inquisition/?leader__name=Palin&leader__age=27") + except SuspiciousOperation: + self.fail("Filters should be allowed if they are defined on a ForeignKey pointing to this model") + class SaveAsTests(TestCase): fixtures = ['admin-views-users.xml','admin-views-person.xml'] |
