summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2010-03-20 15:23:10 +0000
committerKaren Tracey <kmtracey@gmail.com>2010-03-20 15:23:10 +0000
commiteb1c7b033ddac99b333407ba0b964831aa5ef9c4 (patch)
treecb16cffa7a70c6cdbac46c9f1f7b15c887389f05
parent32134986812442347a72186c2b552fd1b29f2494 (diff)
[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
-rw-r--r--django/contrib/admin/options.py7
-rw-r--r--tests/regressiontests/admin_views/tests.py23
2 files changed, 26 insertions, 4 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index f29c6a7299..d4b3d4de0e 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -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
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 756cb18f4d..129f93cdac 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -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)