Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #13081 - Admin actions lose get-parameters in changelis…

…t view

  
Thanks to joh for report and to SmileyChris for patch.

Backport of [13696] from trunk


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13697 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a04398eb1b958830698fe42bd9f5244662e7d8b3 1 parent 1b910d7
Luke Plant authored September 07, 2010
2  django/contrib/admin/options.py
@@ -754,7 +754,7 @@ def response_action(self, request, queryset):
754 754
             if isinstance(response, HttpResponse):
755 755
                 return response
756 756
             else:
757  
-                return HttpResponseRedirect(".")
  757
+                return HttpResponseRedirect(request.get_full_path())
758 758
         else:
759 759
             msg = _("No action selected.")
760 760
             self.message_user(request, msg)
15  tests/regressiontests/admin_views/tests.py
@@ -1477,6 +1477,21 @@ def test_custom_function_action_with_redirect(self):
1477 1477
         response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
1478 1478
         self.failUnlessEqual(response.status_code, 302)
1479 1479
 
  1480
+    def test_default_redirect(self):
  1481
+        """
  1482
+        Test that actions which don't return an HttpResponse are redirected to
  1483
+        the same page, retaining the querystring (which may contain changelist
  1484
+        information).
  1485
+        """
  1486
+        action_data = {
  1487
+            ACTION_CHECKBOX_NAME: [1],
  1488
+            'action' : 'external_mail',
  1489
+            'index': 0,
  1490
+        }
  1491
+        url = '/test_admin/admin/admin_views/externalsubscriber/?ot=asc&o=1'
  1492
+        response = self.client.post(url, action_data)
  1493
+        self.assertRedirects(response, url)
  1494
+
1480 1495
     def test_model_without_action(self):
1481 1496
         "Tests a ModelAdmin without any action"
1482 1497
         response = self.client.get('/test_admin/admin/admin_views/oldsubscriber/')

0 notes on commit a04398e

Please sign in to comment.
Something went wrong with that request. Please try again.