managers.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:django-icekit 作者: ic-labs 项目源码 文件源码
def published(self, for_user=UNSET, force_exchange=False):
        """
        Apply additional filtering of published items over that done in
        `PublishingQuerySet.published` to filter based on additional publising
        date fields used by Fluent.
        """
        if for_user is not UNSET:
            return self.visible()

        queryset = super(PublishingUrlNodeQuerySet, self).published(
            for_user=for_user, force_exchange=force_exchange)

        # Exclude by publication date on the published version of items, *not*
        # the draft vesion, or we could get the wrong result.
        # Exclude fields of published copy of draft items, not draft itself...
        queryset = queryset.exclude(
            Q(publishing_is_draft=True) & Q(
                Q(publishing_linked__publication_date__gt=now())
                | Q(publishing_linked__publication_end_date__lte=now())))
        # ...and exclude fields directly on published items
        queryset = queryset.exclude(
            Q(publishing_is_draft=False) & Q(
                Q(publication_date__gt=now())
                | Q(publication_end_date__lte=now())))

        return queryset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号