Ticket #14742: select_across.patch

File select_across.patch, 2.1 KB (added by curtis@…, 13 years ago)
  • options.py

     
    736736            select_across = action_form.cleaned_data['select_across']
    737737            func, name, description = self.get_actions(request)[action]
    738738
     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
    739744            # Get the list of selected PKs. If nothing's selected, we can't
    740745            # perform an action on it, so bail. Except we want to perform
    741746            # the action explicitly on all objects.
     
    992997        # Actions with no confirmation
    993998        if (actions and request.method == 'POST' and
    994999                '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
    10011003            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)
    10051004                action_failed = True
    10061005
    10071006        # Actions with confirmation
  • helpers.py

     
    1717
    1818class ActionForm(forms.Form):
    1919    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,
    2121        widget=forms.HiddenInput({'class': 'select-across'}))
    2222
    2323checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False)
Back to Top