Code

Ticket #12962: with_test_change-12812.diff

File with_test_change-12812.diff, 2.0 KB (added by mlavin, 4 years ago)

ptone's patch with updated test

Line 
1Index: django/contrib/admin/options.py
2===================================================================
3--- django/contrib/admin/options.py     (revision 12812)
4+++ django/contrib/admin/options.py     (working copy)
5@@ -698,10 +698,6 @@
6         changelist; it returns an HttpResponse if the action was handled, and
7         None otherwise.
8         """
9-        if 'index' not in request.POST:
10-            # If "Go" was not pushed then we can assume the POST was for
11-            # an inline edit save and we do not need to validate the form.
12-            return None
13 
14         # There can be multiple action forms on the page (at the top
15         # and bottom of the change list, for example). Get the action
16@@ -978,9 +974,9 @@
17             return HttpResponseRedirect(request.path + '?' + ERROR_FLAG + '=1')
18 
19         # If the request was POSTed, this might be a bulk action or a bulk edit.
20-        # Try to look up an action first, but if this isn't an action the POST
21+        # Try to look up an action or confirmation first, but if this isn't an action the POST
22         # will fall through to the bulk edit check, below.
23-        if actions and request.method == 'POST':
24+        if actions and request.method == 'POST' and (helpers.ACTION_CHECKBOX_NAME in request.POST or 'index' in request.POST):
25             response = self.response_action(request, queryset=cl.get_query_set())
26             if response:
27                 return response
28Index: tests/regressiontests/admin_views/tests.py
29===================================================================
30--- tests/regressiontests/admin_views/tests.py  (revision 12812)
31+++ tests/regressiontests/admin_views/tests.py  (working copy)
32@@ -1340,7 +1340,6 @@
33         delete_confirmation_data = {
34             ACTION_CHECKBOX_NAME: [1, 2],
35             'action' : 'delete_selected',
36-            'index': 0,
37             'post': 'yes',
38         }
39         confirmation = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)