base.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def render_table_actions(self):
        """Renders the actions specified in ``Meta.table_actions``."""
        template_path = self._meta.table_actions_template
        table_actions_template = template.loader.get_template(template_path)
        bound_actions = self.get_table_actions()
        extra_context = {"table_actions": bound_actions,
                         "table_actions_buttons": [],
                         "table_actions_menu": []}
        if self._meta.filter and (
                self._filter_action(self._meta._filter_action, self.request)):
            extra_context["filter"] = self._meta._filter_action
        for action in bound_actions:
            if action.__class__ in self._meta.table_actions_menu:
                extra_context['table_actions_menu'].append(action)
            elif action != extra_context.get('filter'):
                extra_context['table_actions_buttons'].append(action)
        context = template.RequestContext(self.request, extra_context)
        self.set_multiselect_column_visibility(len(bound_actions) > 0)
        return table_actions_template.render(context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号