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


Python index.Indexed方法代码示例

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


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

示例1: get_boosts

# 需要导入模块: from wagtail.wagtailsearch import index [as 别名]
# 或者: from wagtail.wagtailsearch.index import Indexed [as 别名]
def get_boosts():
    boosts = set()
    for model in apps.get_models():
        if issubclass(model, Indexed):
            for search_field in get_search_fields(model.get_search_fields()):
                boost = search_field.boost
                if boost is not None:
                    boosts.add(boost)
    return boosts 
开发者ID:wagtail,项目名称:wagtail-pg-search-backend,代码行数:11,代码来源:utils.py

示例2: test_inheritance

# 需要导入模块: from wagtail.wagtailsearch import index [as 别名]
# 或者: from wagtail.wagtailsearch.index import Indexed [as 别名]
def test_inheritance(self):
        self.assertTrue(issubclass(CustomContent, index.Indexed))
        self.assertTrue(issubclass(CustomContent, models.Model))

    # fields 
开发者ID:AccentDesign,项目名称:django_wagtail_boilerplate,代码行数:7,代码来源:test_snippet_custom_content.py

示例3: test_inheritance

# 需要导入模块: from wagtail.wagtailsearch import index [as 别名]
# 或者: from wagtail.wagtailsearch.index import Indexed [as 别名]
def test_inheritance(self):
        self.assertTrue(issubclass(TwoColumn, index.Indexed))
        self.assertTrue(issubclass(TwoColumn, models.Model))

    # fields 
开发者ID:AccentDesign,项目名称:django_wagtail_boilerplate,代码行数:7,代码来源:test_snippet_two_column.py

示例4: test_inheritance

# 需要导入模块: from wagtail.wagtailsearch import index [as 别名]
# 或者: from wagtail.wagtailsearch.index import Indexed [as 别名]
def test_inheritance(self):
        self.assertTrue(issubclass(Card, index.Indexed))
        self.assertTrue(issubclass(Card, AbstractCard))

    # meta 
开发者ID:AccentDesign,项目名称:django_wagtail_boilerplate,代码行数:7,代码来源:test_snippet_card.py

示例5: chooser

# 需要导入模块: from wagtail.wagtailsearch import index [as 别名]
# 或者: from wagtail.wagtailsearch.index import Indexed [as 别名]
def chooser(request, app_label, model_name, filter_name=None):

    try:
        model = apps.get_model(app_label, model_name)
        chooser = registry.choosers[model]
    except (LookupError, ValueError, KeyError):
        raise Http404

    qs = chooser.get_queryset(request)

    is_searchable = issubclass(model, Indexed)
    is_searching = is_searchable and request.GET.get('q')

    if is_searching:
        qs = qs.search(request.GET['q'])

    if filter_name is not None:
        try:
            filter_func = registry.filters[model, filter_name]
        except KeyError:
            raise Http404
        qs = filter_func(qs)

    paginator, page = paginate(request, qs, per_page=10)
    ajax = 'ajax' in request.GET

    context = {
        'chooser': chooser,
        'chooser_url': request.path,
        'opts': model._meta,
        'paginator': paginator,
        'page': page,
        'object_list': page.object_list,
        'is_searchable': is_searchable,
        'is_searching': is_searching,
    }

    if ajax:
        return render(request, 'wagtailmodelchooser/results.html', context)
    else:
        return render_modal_workflow(
            request,
            'wagtailmodelchooser/modal.html',
            'wagtailmodelchooser/modal.js',
            context) 
开发者ID:takeflight,项目名称:wagtailmodelchooser,代码行数:47,代码来源:views.py


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