diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-02-26 12:49:15 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-02-26 12:49:15 +0000 |
| commit | 120d01c20b3c2deada995e671f3f918aa1d808ce (patch) | |
| tree | 43134e366ae3578e0b47a8819001b6f708933666 /tests | |
| parent | 3a3102378312e2eaf4d220e46984b705bae0877b (diff) | |
[1.2.X] Fixed #10918 -- Ensure that the search widget on a raw_id_admin uses the right field name when the ForeignKey has a to_field definition. Thanks to David Cramer for the report, Collin Anderson for the fix, and Julien Phalip for the test.
Backport of r15657 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index d2d1967c05..73c9060062 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -1556,6 +1556,16 @@ class AdminSearchTest(TestCase): # confirm the search returned 1 object self.assertContains(response, "\n1 recommendation\n") + def test_with_fk_to_field(self): + """Ensure that the to_field GET parameter is preserved when a search + is performed. Refs #10918. + """ + from django.contrib.admin.views.main import TO_FIELD_VAR + response = self.client.get('/test_admin/admin/auth/user/?q=joe&%s=username' % TO_FIELD_VAR) + self.assertContains(response, "\n1 user\n") + self.assertContains(response, '<input type="hidden" name="t" value="username"/>') + + class AdminInheritedInlinesTest(TestCase): fixtures = ['admin-views-users.xml',] |
