当前位置: 首页>>代码示例>>Python>>正文


Python filters.SEARCH_VAR属性代码示例

本文整理汇总了Python中xadmin.filters.SEARCH_VAR属性的典型用法代码示例。如果您正苦于以下问题:Python filters.SEARCH_VAR属性的具体用法?Python filters.SEARCH_VAR怎么用?Python filters.SEARCH_VAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在xadmin.filters的用法示例。


在下文中一共展示了filters.SEARCH_VAR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: block_top_navbar

# 需要导入模块: from xadmin import filters [as 别名]
# 或者: from xadmin.filters import SEARCH_VAR [as 别名]
def block_top_navbar(self, context, nodes):
        search_models = []

        site_name = self.admin_site.name
        if self.global_search_models == None:
            models = self.admin_site._registry.keys()
        else:
            models = self.global_search_models

        for model in models:
            app_label = model._meta.app_label

            if self.has_model_perm(model, "view"):
                info = (app_label, model._meta.model_name)
                if getattr(self.admin_site._registry[model], 'search_fields', None):
                    try:
                        search_models.append({
                            'title': _('Search %s') % capfirst(model._meta.verbose_name_plural),
                            'url': reverse('xadmin:%s_%s_changelist' % info, current_app=site_name),
                            'model': model
                        })
                    except NoReverseMatch:
                        pass
        return nodes.append(loader.render_to_string('xadmin/blocks/comm.top.topnav.html', {'search_models': search_models, 'search_name': SEARCH_VAR})) 
开发者ID:stormsha,项目名称:StormOnline,代码行数:26,代码来源:topnav.py

示例2: block_top_navbar

# 需要导入模块: from xadmin import filters [as 别名]
# 或者: from xadmin.filters import SEARCH_VAR [as 别名]
def block_top_navbar(self, context, nodes):
        search_models = []

        site_name = self.admin_site.name
        if self.global_search_models == None:
            models = self.admin_site._registry.keys()
        else:
            models = self.global_search_models

        for model in models:
            app_label = model._meta.app_label

            if self.has_model_perm(model, "view"):
                info = (app_label, model._meta.model_name)
                if getattr(self.admin_site._registry[model], 'search_fields', None):
                    try:
                        search_models.append({
                            'title': _('Search %s') % capfirst(model._meta.verbose_name_plural),
                            'url': reverse('xadmin:%s_%s_changelist' % info, current_app=site_name),
                            'model': model
                        })
                    except NoReverseMatch:
                        pass

        nodes.append(loader.render_to_string('xadmin/blocks/comm.top.topnav.html', {'search_models': search_models, 'search_name': SEARCH_VAR})) 
开发者ID:madre,项目名称:devops,代码行数:27,代码来源:topnav.py

示例3: block_nav_form

# 需要导入模块: from xadmin import filters [as 别名]
# 或者: from xadmin.filters import SEARCH_VAR [as 别名]
def block_nav_form(self, context, nodes):
        if self.search_fields:
            nodes.append(
                loader.render_to_string(
                    'xadmin/blocks/model_list.nav_form.search_form.html',
                    {'search_var': SEARCH_VAR,
                        'remove_search_url': self.admin_view.get_query_string(remove=[SEARCH_VAR]),
                        'search_form_params': self.admin_view.get_form_params(remove=[SEARCH_VAR])},
                    context_instance=context)) 
开发者ID:madre,项目名称:devops,代码行数:11,代码来源:filters.py

示例4: block_nav_form

# 需要导入模块: from xadmin import filters [as 别名]
# 或者: from xadmin.filters import SEARCH_VAR [as 别名]
def block_nav_form(self, context, nodes):
        if self.search_fields:
            context = get_context_dict(context or {})  # no error!
            context.update({
                'search_var': SEARCH_VAR,
                'remove_search_url': self.admin_view.get_query_string(remove=[SEARCH_VAR]),
                'search_form_params': self.admin_view.get_form_params(remove=[SEARCH_VAR])
            })
            nodes.append(
                loader.render_to_string(
                    'xadmin/blocks/model_list.nav_form.search_form.html',
                    context=context)
            ) 
开发者ID:Liweimin0512,项目名称:ImitationTmall_Django,代码行数:15,代码来源:filters.py


注:本文中的xadmin.filters.SEARCH_VAR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。