[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
This commit is contained in:
parent
3213498681
commit
eb1c7b033d
@ -665,6 +665,7 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
changelist; it returns an HttpResponse if the action was handled, and
|
changelist; it returns an HttpResponse if the action was handled, and
|
||||||
None otherwise.
|
None otherwise.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# There can be multiple action forms on the page (at the top
|
# There can be multiple action forms on the page (at the top
|
||||||
# and bottom of the change list, for example). Get the action
|
# and bottom of the change list, for example). Get the action
|
||||||
# whose button was pushed.
|
# whose button was pushed.
|
||||||
@ -916,9 +917,9 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
return HttpResponseRedirect(request.path + '?' + ERROR_FLAG + '=1')
|
return HttpResponseRedirect(request.path + '?' + ERROR_FLAG + '=1')
|
||||||
|
|
||||||
# If the request was POSTed, this might be a bulk action or a bulk edit.
|
# 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
|
# Try to look up an action or confirmation first, but if this isn't an
|
||||||
# will fall through to the bulk edit check, below.
|
# action the POST will fall through to the bulk edit check, below.
|
||||||
if actions and request.method == 'POST':
|
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())
|
response = self.response_action(request, queryset=cl.get_query_set())
|
||||||
if response:
|
if response:
|
||||||
return response
|
return response
|
||||||
|
@ -1025,6 +1025,28 @@ class AdminViewListEditable(TestCase):
|
|||||||
# 1 select per object = 3 selects
|
# 1 select per object = 3 selects
|
||||||
self.failUnlessEqual(response.content.count("<select"), 4)
|
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):
|
def test_post_submission(self):
|
||||||
data = {
|
data = {
|
||||||
"form-TOTAL_FORMS": "3",
|
"form-TOTAL_FORMS": "3",
|
||||||
@ -1265,7 +1287,6 @@ class AdminActionsTest(TestCase):
|
|||||||
delete_confirmation_data = {
|
delete_confirmation_data = {
|
||||||
ACTION_CHECKBOX_NAME: [1, 2],
|
ACTION_CHECKBOX_NAME: [1, 2],
|
||||||
'action' : 'delete_selected',
|
'action' : 'delete_selected',
|
||||||
'index': 0,
|
|
||||||
'post': 'yes',
|
'post': 'yes',
|
||||||
}
|
}
|
||||||
confirmation = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
confirmation = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user