當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。