Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@jkocherhans jkocherhans authored
View
5 django/contrib/admin/options.py
@@ -698,6 +698,11 @@ def response_action(self, request, queryset):
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.
View
22 tests/regressiontests/admin_views/tests.py
@@ -940,6 +940,28 @@ def test_changelist_input_html(self):
# 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",
Please sign in to comment.
Something went wrong with that request. Please try again.