當前位置: 首頁>>代碼示例>>Python>>正文


Python Article.get_all_newest_contents_all_languages方法代碼示例

本文整理匯總了Python中wikipendium.wiki.models.Article.get_all_newest_contents_all_languages方法的典型用法代碼示例。如果您正苦於以下問題:Python Article.get_all_newest_contents_all_languages方法的具體用法?Python Article.get_all_newest_contents_all_languages怎麽用?Python Article.get_all_newest_contents_all_languages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wikipendium.wiki.models.Article的用法示例。


在下文中一共展示了Article.get_all_newest_contents_all_languages方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: index

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def index(request):
    acs = Article.get_all_newest_contents_all_languages()
    now = timezone.now()

    acs_updated_in_the_last_24_hours = filter(
        lambda ac: ac.updated > now - timezone.timedelta(hours=24), acs)

    acs_updated_in_the_last_week = filter(
        lambda ac: ac.updated > now - timezone.timedelta(days=7), acs)

    acs_updated_in_the_last_month = filter(
        lambda ac: ac.updated > now - timezone.timedelta(days=30), acs)

    user_stats = _generate_user_statistics_for_one_day(
        year=now.year, month=now.month, day=now.day
    )

    article_length_stats = _generate_article_length_statistics(acs)

    return render(request, 'stats/index.html', {
        'number_of_acs_updated_in_the_last_24_hours':
            len(acs_updated_in_the_last_24_hours),
        'number_of_acs_updated_in_the_last_week':
            len(acs_updated_in_the_last_week),
        'number_of_acs_updated_in_the_last_month':
            len(acs_updated_in_the_last_month),
        'users': user_stats,
        'compendium_length_stats': article_length_stats,
    })
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:31,代碼來源:views.py

示例2: home

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def home(request):

    all_newest_contents = Article.get_all_newest_contents_all_languages()

    compendiums = [
        {"label": ac.get_full_title(), "url": ac.get_absolute_url(), "lang": ac.lang, "updated": str(ac.updated)}
        for ac in all_newest_contents
    ]

    return render(request, "index.html", {"compendiums": json.dumps(compendiums)})
開發者ID:tOgg1,項目名稱:wikipendium.no,代碼行數:12,代碼來源:views.py

示例3: tag

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def tag(request, tag_slug):
    tag = get_object_or_404(Tag, slug=tag_slug)
    articles_with_tag = Article.objects.filter(tags=tag)
    all_newest_contents = Article.get_all_newest_contents_all_languages()
    filtered_contents = filter(lambda ac: ac.article in articles_with_tag, all_newest_contents)
    if len(filtered_contents) == 0:
        raise Http404
    compendiums = [
        {"label": ac.get_full_title(), "url": ac.get_absolute_url(), "lang": ac.lang, "updated": str(ac.updated)}
        for ac in filtered_contents
    ]

    return render(request, "index.html", {"compendiums": json.dumps(compendiums), "tag": tag})
開發者ID:tOgg1,項目名稱:wikipendium.no,代碼行數:15,代碼來源:views.py

示例4: home

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def home(request):

    all_newest_contents = Article.get_all_newest_contents_all_languages()

    trie = [{
        "label": ac.get_full_title(),
        "url": ac.get_absolute_url(),
        "lang": ac.lang,
        "updated": str(ac.updated),
    } for ac in all_newest_contents]

    return render(request, 'index.html', {
        "trie": json.dumps(trie),
    })
開發者ID:peterhgombos,項目名稱:wikipendium.no,代碼行數:16,代碼來源:views.py

示例5: home

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def home(request):

    all_newest_contents = Article.get_all_newest_contents_all_languages()

    compendiums = [{
        'label': ac.get_full_title(),
        'url': ac.get_absolute_url(),
        'lang': ac.lang,
        'updated': str(ac.updated),
    } for ac in all_newest_contents]

    return render(request, 'index.html', {
        'compendiums': json.dumps(compendiums),
    })
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:16,代碼來源:views.py

示例6: tag

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
def tag(request, tag_slug):
    tag = get_object_or_404(Tag, slug=tag_slug)
    articles_with_tag = Article.objects.filter(tags=tag)
    all_newest_contents = Article.get_all_newest_contents_all_languages()
    filtered_contents = filter(lambda ac: ac.article in articles_with_tag,
                               all_newest_contents)
    if len(filtered_contents) == 0:
        raise Http404
    compendiums = [{
        'label': ac.get_full_title(),
        'url': ac.get_absolute_url(),
        'lang': ac.lang,
        'updated': str(ac.updated),
    } for ac in filtered_contents]

    return render(request, 'index.html', {
        'compendiums': json.dumps(compendiums),
        'tag': tag,
    })
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:21,代碼來源:views.py

示例7: test_get_all_newest_contents_all_languages

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
 def test_get_all_newest_contents_all_languages(self):
     result = Article.get_all_newest_contents_all_languages()
     expected_result = [self.ac4, self.ac3, self.ac2]
     self.assertEquals(expected_result, result)
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:6,代碼來源:tests.py

示例8: items

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
 def items(self):
     return Article.get_all_newest_contents_all_languages()
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:4,代碼來源:sitemap.py

示例9: index_queryset

# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import get_all_newest_contents_all_languages [as 別名]
 def index_queryset(self, using=None):
     return ArticleContent.objects.filter(
         pk__in=[ac.pk
                 for ac in Article.get_all_newest_contents_all_languages()])
開發者ID:stianjensen,項目名稱:wikipendium.no,代碼行數:6,代碼來源:search_indexes.py


注:本文中的wikipendium.wiki.models.Article.get_all_newest_contents_all_languages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。