mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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
This commit is contained in:
@@ -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']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user