示例#1
0
 def published(self):
     """
     Return only published pages
     """
     from fluent_pages.models import UrlNode   # the import can't be globally, that gives a circular dependency
     return self \
         .filter(status=UrlNode.PUBLISHED) \
         .filter(
             Q(publication_date__isnull=True) |
             Q(publication_date__lt=now())
         ).filter(
             Q(publication_end_date__isnull=True) |
             Q(publication_end_date__gte=now())
         )
    def published(self):
        """
        Return only published pages for the current site.

        .. versionchanged:: 0.9 This filter only returns the pages of the current site.
        """
        from fluent_pages.models import UrlNode   # the import can't be globally, that gives a circular dependency

        return self \
            ._single_site() \
            .filter(status=UrlNode.PUBLISHED) \
            .filter(
                Q(publication_date__isnull=True) |
                Q(publication_date__lt=now())
            ).filter(
                Q(publication_end_date__isnull=True) |
                Q(publication_end_date__gte=now())
            )
示例#3
0
    def published(self):
        """
        Return only published pages for the current site.

        .. versionchanged:: 0.9 This filter only returns the pages of the current site.
        """
        from fluent_pages.models import UrlNode  # the import can't be globally, that gives a circular dependency

        return self \
            ._single_site() \
            .filter(status=UrlNode.PUBLISHED) \
            .filter(
                Q(publication_date__isnull=True) |
                Q(publication_date__lt=now())
            ).filter(
                Q(publication_end_date__isnull=True) |
                Q(publication_end_date__gte=now())
            )