Commit eb1c7b03 authored by Karen Tracey's avatar Karen Tracey
Browse files

[1.1.X] Fixed #12707. Admin action messages are no longer displayed when...

[1.1.X] Fixed #12707. Admin action messages are no longer displayed when submitting list_editable content. Thanks, copelco. 

and 

Fixed #12962: Made admin delete action work again. Thanks ptone, skevy, mlavin and anyone else I've missed. 

r12525 and r12813 from trunk, together to avoid the regression introduced by r12525 alone.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12815 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 32134986
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -665,6 +665,7 @@ class ModelAdmin(BaseModelAdmin):
        changelist; it returns an HttpResponse if the action was handled, and
        None otherwise.
        """

        # There can be multiple action forms on the page (at the top
        # and bottom of the change list, for example). Get the action
        # whose button was pushed.
@@ -916,9 +917,9 @@ class ModelAdmin(BaseModelAdmin):
            return HttpResponseRedirect(request.path + '?' + ERROR_FLAG + '=1')

        # If the request was POSTed, this might be a bulk action or a bulk edit.
        # Try to look up an action first, but if this isn't an action the POST
        # will fall through to the bulk edit check, below.
        if actions and request.method == 'POST':
        # Try to look up an action or confirmation first, but if this isn't an
        # action the POST will fall through to the bulk edit check, below.
        if actions and request.method == 'POST' and (helpers.ACTION_CHECKBOX_NAME in request.POST or 'index' in request.POST):
            response = self.response_action(request, queryset=cl.get_query_set())
            if response:
                return response
+22 −1
Original line number Diff line number Diff line
@@ -1025,6 +1025,28 @@ class AdminViewListEditable(TestCase):
        # 1 select per object = 3 selects
        self.failUnlessEqual(response.content.count("<select"), 4)

    def test_post_messages(self):
        # Ticket 12707: Saving inline editable should not show admin
        # action warnings
        data = {
            "form-TOTAL_FORMS": "3",
            "form-INITIAL_FORMS": "3",
            "form-MAX_NUM_FORMS": "0",

            "form-0-gender": "1",
            "form-0-id": "1",

            "form-1-gender": "2",
            "form-1-id": "2",

            "form-2-alive": "checked",
            "form-2-gender": "1",
            "form-2-id": "3",
        }
        response = self.client.post('/test_admin/admin/admin_views/person/',
                                    data, follow=True)
        self.assertEqual(len(response.context['messages']), 1)

    def test_post_submission(self):
        data = {
            "form-TOTAL_FORMS": "3",
@@ -1265,7 +1287,6 @@ class AdminActionsTest(TestCase):
        delete_confirmation_data = {
            ACTION_CHECKBOX_NAME: [1, 2],
            'action' : 'delete_selected',
            'index': 0,
            'post': 'yes',
        }
        confirmation = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)