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