def _get_action_urls(self):
        """Get the url patterns that route each action to a view."""
        actions = {}

        model_name = self.model._meta.model_name
        # e.g.: polls_poll
        base_url_name = '%s_%s' % (self.model._meta.app_label, model_name)
        # e.g.: polls_poll_actions
        model_actions_url_name = '%s_actions' % base_url_name

        self.tools_view_name = 'admin:' + model_actions_url_name

        # WISHLIST use get_change_actions and get_changelist_actions
        # TODO separate change and changelist actions
        for action in chain(self.change_actions, self.changelist_actions):
            actions[action] = getattr(self, action)
        return [
            # change, supports the same pks the admin does
            # https://github.com/django/django/blob/stable/1.10.x/django/contrib/admin/options.py#L555
            url(r'^(?P<pk>.+)/actions/(?P<tool>\w+)/$',
                self.admin_site.admin_view(  # checks permissions
                    ChangeActionView.as_view(
                        model=self.model,
                        actions=actions,
                        back='admin:%s_change' % base_url_name,
                        current_app=self.admin_site.name,
                    )
                ),
                name=model_actions_url_name),
            # changelist
            url(r'^actions/(?P<tool>\w+)/$',
                self.admin_site.admin_view(  # checks permissions
                    ChangeListActionView.as_view(
                        model=self.model,
                        actions=actions,
                        back='admin:%s_changelist' % base_url_name,
                        current_app=self.admin_site.name,
                    )
                ),
                # Dupe name is fine. https://code.djangoproject.com/ticket/14259
                name=model_actions_url_name),
        ]
def _get_action_urls ( self ) : actions = { } model_name = self . model . _meta . model_name base_url_name = '%s_%s' % ( self . model . _meta . app_label , model_name ) model_actions_url_name = '%s_actions' % base_url_name self . tools_view_name = 'admin:' + model_actions_url_name for action in chain ( self . change_actions , self . changelist_actions ) : actions [ action ] = getattr ( self , action ) return [ url ( r'^(?P<pk>.+)/actions/(?P<tool>\w+)/$' , self . admin_site . admin_view ( ChangeActionView . as_view ( model = self . model , actions = actions , back = 'admin:%s_change' % base_url_name , current_app = self . admin_site . name , ) ) , name = model_actions_url_name ) , url ( r'^actions/(?P<tool>\w+)/$' , self . admin_site . admin_view ( ChangeListActionView . as_view ( model = self . model , actions = actions , back = 'admin:%s_changelist' % base_url_name , current_app = self . admin_site . name , ) ) , name = model_actions_url_name ) , ]
Get the url patterns that route each action to a view.