Ticket #14742: select_across.patch
File select_across.patch, 2.1 KB (added by , 14 years ago) |
---|
-
options.py
736 736 select_across = action_form.cleaned_data['select_across'] 737 737 func, name, description = self.get_actions(request)[action] 738 738 739 # Allow each action to choose if it requires selections, or will 740 # operate on all matching records by default 741 if select_across is None: 742 select_across = getattr(func, 'select_across', False) 743 739 744 # Get the list of selected PKs. If nothing's selected, we can't 740 745 # perform an action on it, so bail. Except we want to perform 741 746 # the action explicitly on all objects. … … 992 997 # Actions with no confirmation 993 998 if (actions and request.method == 'POST' and 994 999 'index' in request.POST and '_save' not in request.POST): 995 if selected: 996 response = self.response_action(request, queryset=cl.get_query_set()) 997 if response: 998 return response 999 else: 1000 action_failed = True 1000 response = self.response_action(request, queryset=cl.get_query_set()) 1001 if response: 1002 return response 1001 1003 else: 1002 msg = _("Items must be selected in order to perform "1003 "actions on them. No items have been changed.")1004 self.message_user(request, msg)1005 1004 action_failed = True 1006 1005 1007 1006 # Actions with confirmation -
helpers.py
17 17 18 18 class ActionForm(forms.Form): 19 19 action = forms.ChoiceField(label=_('Action:')) 20 select_across = forms. BooleanField(label='', required=False, initial=0,20 select_across = forms.NullBooleanField(label='', required=False, initial=None, 21 21 widget=forms.HiddenInput({'class': 'select-across'})) 22 22 23 23 checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False)