Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…hen 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
  • Loading branch information...
commit eb1c7b033ddac99b333407ba0b964831aa5ef9c4 1 parent 3213498
Karen Tracey kmtracey authored
7 django/contrib/admin/options.py
View
@@ -665,6 +665,7 @@ def response_action(self, request, queryset):
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 @@ def changelist_view(self, request, extra_context=None):
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
23 tests/regressiontests/admin_views/tests.py
View
@@ -1025,6 +1025,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",
@@ -1265,7 +1287,6 @@ def test_model_admin_default_delete_action(self):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.