Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…itting list_editable content. Thanks, copelco.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12525 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7aeb37d610700fe25b07d5e76b943cc3d51ab1a5 1 parent 871a99c
Joseph Kocherhans authored February 23, 2010
5  django/contrib/admin/options.py
@@ -698,6 +698,11 @@ def response_action(self, request, queryset):
698 698
         changelist; it returns an HttpResponse if the action was handled, and
699 699
         None otherwise.
700 700
         """
  701
+        if 'index' not in request.POST:
  702
+            # If "Go" was not pushed then we can assume the POST was for
  703
+            # an inline edit save and we do not need to validate the form.
  704
+            return None
  705
+
701 706
         # There can be multiple action forms on the page (at the top
702 707
         # and bottom of the change list, for example). Get the action
703 708
         # whose button was pushed.
22  tests/regressiontests/admin_views/tests.py
@@ -940,6 +940,28 @@ def test_changelist_input_html(self):
940 940
         # 1 select per object = 3 selects
941 941
         self.failUnlessEqual(response.content.count("<select"), 4)
942 942
 
  943
+    def test_post_messages(self):
  944
+        # Ticket 12707: Saving inline editable should not show admin
  945
+        # action warnings
  946
+        data = {
  947
+            "form-TOTAL_FORMS": "3",
  948
+            "form-INITIAL_FORMS": "3",
  949
+            "form-MAX_NUM_FORMS": "0",
  950
+
  951
+            "form-0-gender": "1",
  952
+            "form-0-id": "1",
  953
+
  954
+            "form-1-gender": "2",
  955
+            "form-1-id": "2",
  956
+
  957
+            "form-2-alive": "checked",
  958
+            "form-2-gender": "1",
  959
+            "form-2-id": "3",
  960
+        }
  961
+        response = self.client.post('/test_admin/admin/admin_views/person/',
  962
+                                    data, follow=True)
  963
+        self.assertEqual(len(response.context['messages']), 1)
  964
+
943 965
     def test_post_submission(self):
944 966
         data = {
945 967
             "form-TOTAL_FORMS": "3",

0 notes on commit 7aeb37d

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