Commit 7aeb37d6 authored by Joseph Kocherhans's avatar Joseph Kocherhans
Browse files

Fixed #12707. Admin action messages are no longer displayed when submitting...

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12525 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 871a99c9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -698,6 +698,11 @@ class ModelAdmin(BaseModelAdmin):
        changelist; it returns an HttpResponse if the action was handled, and
        None otherwise.
        """
        if 'index' not in request.POST:
            # If "Go" was not pushed then we can assume the POST was for
            # an inline edit save and we do not need to validate the form.
            return None

        # 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.
+22 −0
Original line number Diff line number Diff line
@@ -940,6 +940,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",