1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.0.X] Fixed #9252 -- Moved the try/except protecting against incorrect lookup params to where the error is now raised, and added a test for this case.

Backport of [9245] from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey
2008-10-22 23:14:48 +00:00
parent d7ebda8d08
commit 74997f95de
2 changed files with 18 additions and 10 deletions

View File

@@ -160,7 +160,14 @@ class AdminViewBasicTest(TestCase):
'<a href="?color__id__exact=3">Blue</a>' in response.content,
"Changelist filter not correctly limited by limit_choices_to."
)
def testIncorrectLookupParameters(self):
"""Ensure incorrect lookup parameters are handled gracefully."""
response = self.client.get('/test_admin/admin/admin_views/thing/', {'notarealfield': '5'})
self.assertRedirects(response, '/test_admin/admin/admin_views/thing/?e=1')
response = self.client.get('/test_admin/admin/admin_views/thing/', {'color__id__exact': 'StringNotInteger!'})
self.assertRedirects(response, '/test_admin/admin/admin_views/thing/?e=1')
def get_perm(Model, perm):
"""Return the permission object, for the Model"""
ct = ContentType.objects.get_for_model(Model)