How to use the puput.models.BlogPage.objects.filter function in puput

To help you get started, we’ve selected a few puput examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github APSL / puput / puput / managers.py View on Github external
def get_by_path(self, blog_path):
        # Look for the blog checking all the path
        from .models import BlogPage
        blogs = BlogPage.objects.filter(slug=blog_path.split("/")[-1])
        for blog in blogs:
            if strip_prefix_and_ending_slash(blog.specific.last_url_part) == blog_path:
                return blog.specific
        return
github dataletsch / blemmy / publichealth / home / models / models.py View on Github external
def newsfeed(self):
        # Get list of latest news
        curlang = translation.get_language()
        parent = BlogPage.objects.filter(slug='news-%s' % curlang)
        if not parent: return []
        entries = EntryPage.objects.live().descendant_of(parent[0])
        # Order by most recent date first
        entries = entries.order_by('-date')
        return entries[:4]