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


Python managers.entries_published函数代码示例

本文整理汇总了Python中zinnia.managers.entries_published函数的典型用法代码示例。如果您正苦于以下问题:Python entries_published函数的具体用法?Python entries_published怎么用?Python entries_published使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: author_detail

def author_detail(request, **kwargs):
    """Display the entries of an author"""
    username = kwargs.pop('username')
    page = kwargs['page'] if 'page' in kwargs else None
    author = get_object_or_404(User, username=username)
    extra_context = {'author': author}
    filter = {}
    if ZINNIA_BLOG_ACTIVE:
        blog_slug = kwargs.pop('blog_slug')
        blog = get_object_or_404(Blog, slug = blog_slug)
        # We check if author is a blog author
        if author not in blog.authors.all():
            raise Http404('User not valid')
        filter = {'blog__slug': blog_slug}
        extra_context.update({'blog': blog, 'filters': filter})
    queryset = entries_published(author.entry_set).filter(**filter)
    return object_list(request, queryset=queryset, paginate_by=PAGINATION, 
                        page=page, extra_context=extra_context)
开发者ID:galotecnia,项目名称:django-blog-zinnia,代码行数:18,代码来源:authors.py

示例2: test_entries_published

 def test_entries_published(self):
     self.assertEqual(entries_published(Entry.objects.all()).count(), 1)
     self.entry_2.status = PUBLISHED
     self.entry_2.save()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 2)
     self.entry_1.sites.clear()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.sites.add(*self.sites)
     self.entry_1.start_publication = datetime(2020, 1, 1)
     self.entry_1.save()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.start_publication = datetime(2000, 1, 1)
     self.entry_1.save()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 2)
     self.entry_1.end_publication = datetime(2000, 1, 1)
     self.entry_1.save()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 1)
     self.entry_1.end_publication = datetime(2020, 1, 1)
     self.entry_1.save()
     self.assertEqual(entries_published(Entry.objects.all()).count(), 2)
开发者ID:1844144,项目名称:django-blog-zinnia,代码行数:20,代码来源:test_managers.py

示例3: items

 def items(self, obj):
     """Items are the published entries of the author"""
     return entries_published(obj.entries)[:FEEDS_MAX_ITEMS]
开发者ID:cyberj,项目名称:django-blog-zinnia,代码行数:3,代码来源:feeds.py

示例4: entries_published

 def entries_published(self):
     """
     Returns author's published entries.
     """
     return entries_published(self.entries)
开发者ID:1844144,项目名称:django-blog-zinnia,代码行数:5,代码来源:author.py

示例5: entries_published

 def entries_published(self):
     """
     Returns category's published entries.
     """
     return entries_published(self.entries)
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:5,代码来源:category.py

示例6: author_detail

def author_detail(request, username):
    """Display the entries of an author"""
    author = get_object_or_404(User, username=username)
    return object_list(request, queryset=entries_published(author.entry_set),
                       extra_context={'author': author})
开发者ID:grzegorzbialy,项目名称:django-blog-zinnia,代码行数:5,代码来源:views.py

示例7: get_query_set

 def get_query_set(self):
     language = get_lang()
     result = entries_published(super(EntryPublishedManager, self).get_query_set())
     if language:
         result = result.filter(language=language)
     return result
开发者ID:bmarchenko,项目名称:bmarchenko,代码行数:6,代码来源:lang_entry.py

示例8: items

 def items(self, obj):
     return entries_published(obj.entry_set)[:FEEDS_MAX_ITEMS]
开发者ID:0Chuzz,项目名称:django-blog-zinnia,代码行数:2,代码来源:feeds.py

示例9: entries_published_set

 def entries_published_set(self, blog_slug=''):
     """Return only the entries published"""
     filter = {}
     if ZINNIA_BLOG_ACTIVE:
         filter.update({'blog__slug': blog_slug})
     return entries_published(self.entry_set.filter(**filter))
开发者ID:galotecnia,项目名称:django-blog-zinnia,代码行数:6,代码来源:models.py

示例10: lastmod

 def lastmod(self, obj):
     entries = entries_published(obj.entry_set)
     if not entries:
         return None
     return entries[0].creation_date
开发者ID:silent7,项目名称:EcoChecks,代码行数:5,代码来源:sitemaps.py

示例11: related_published_set

 def related_published_set(self):   # FIXME: PUBLISHED FILTER
     """Return only related entries published"""
     return entries_published(self.related)
开发者ID:galotecnia,项目名称:django-blog-zinnia,代码行数:3,代码来源:models.py

示例12: cache

 def cache(self, categories=[]):
     len_entries = float(Entry.published.count())
     self.cache_categories = {}
     for cat in categories:
         self.cache_categories[cat.pk] = entries_published(cat.entry_set).count() / len_entries
开发者ID:grzegorzbialy,项目名称:django-blog-zinnia,代码行数:5,代码来源:sitemaps.py

示例13: items

 def items(self, obj):
     return entries_published(obj.entry_set)
开发者ID:redsolution,项目名称:django-blog-zinnia,代码行数:2,代码来源:feeds.py

示例14: related_published

 def related_published(self):
     """Return only related entries published"""
     return entries_published(self.related)
开发者ID:amakhnach,项目名称:django-blog-zinnia,代码行数:3,代码来源:models.py

示例15: lastmod

 def lastmod(self, obj):
     """Return last modification of an author"""
     entries = entries_published(obj.entry_set)
     if not entries:
         return None
     return entries[0].creation_date
开发者ID:fortitou,项目名称:django-blog-zinnia,代码行数:6,代码来源:sitemaps.py


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