Ticket #13081: 13081.diff

File 13081.diff, 1.7 KB (added by Chris Beaven, 14 years ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index 531ce4d..50033c4 100644
    a b class ModelAdmin(BaseModelAdmin):  
    757757            if isinstance(response, HttpResponse):
    758758                return response
    759759            else:
    760                 return HttpResponseRedirect(".")
     760                return HttpResponseRedirect(request.get_full_path())
    761761        else:
    762762            msg = _("No action selected.")
    763763            self.message_user(request, msg)
  • tests/regressiontests/admin_views/tests.py

    diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
    index abb28de..d8e4066 100644
    a b class AdminActionsTest(TestCase):  
    13751375        response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
    13761376        self.failUnlessEqual(response.status_code, 302)
    13771377
     1378    def test_default_redirect(self):
     1379        """
     1380        Test that actions which don't return an HttpResponse are redirected to
     1381        the same page, retaining the querystring (which may contain changelist
     1382        information).
     1383        """
     1384        action_data = {
     1385            ACTION_CHECKBOX_NAME: [1],
     1386            'action' : 'external_mail',
     1387            'index': 0,
     1388        }
     1389        url = '/test_admin/admin/admin_views/externalsubscriber/?ot=asc&o=1'
     1390        response = self.client.post(url, action_data)
     1391        self.assertRedirects(response, url)
     1392
    13781393    def test_model_without_action(self):
    13791394        "Tests a ModelAdmin without any action"
    13801395        response = self.client.get('/test_admin/admin/admin_views/oldsubscriber/')
Back to Top