# Path: puput/models.py
# class BlogPage(BlogRoutes, Page, Blog):
#     extra = BlogManager()
# 
#     content_panels = Page.content_panels + getattr(Blog, 'content_panels', [])
#     settings_panels = Page.settings_panels + getattr(Blog, 'settings_panels', [])
# 
#     subpage_types = ['puput.EntryPage']
# 
#     def get_entries(self):
#         return EntryPage.objects.descendant_of(self).live().order_by('-date').select_related('owner')
# 
#     def get_context(self, request, *args, **kwargs):
#         context = super(BlogPage, self).get_context(request, *args, **kwargs)
#         context['entries'] = self.entries
#         context['blog_page'] = self
#         context['search_type'] = getattr(self, 'search_type', "")
#         context['search_term'] = getattr(self, 'search_term', "")
#         return context
# 
#     @property
#     def last_url_part(self):
#         """
#         Get the BlogPage url without the domain
#         """
#         return self.get_url_parts()[-1]
# 
#     class Meta:
#         verbose_name = _('Blog')


from mimetypes import guess_type
from urllib.parse import urljoin
from django import http
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from django.template.defaultfilters import truncatewords_html
from wagtail.core.models import Site
from .models import BlogPage
        from .urls import get_entry_url
        if request.resolver_match.url_name == 'blog_page_feed_slug':
            self.blog_page = BlogPage.extra.get_by_path(kwargs['blog_path'])
            if not self.blog_page:
                raise http.Http404
        else:
            self.blog_page = BlogPage.objects.first()
        self.request = request
        return super(BlogPageFeed, self).__call__(request, *args, **kwargs)

    def title(self):
        return self.blog_page.title

    def description(self):
        return self.blog_page.description

    def link(self):
        return self.blog_page.last_url_part

    def items(self):
        return self.blog_page.get_entries()[:20]

    def item_title(self, item):
        return item.title

    def _item_short_description(self, item):
        if item.excerpt and item.excerpt.strip() != '':
            return item.excerpt
        else:
            return truncatewords_html(item.body, 70)


# Path: puput/models.py
# class BlogPage(BlogRoutes, Page, Blog):
#     extra = BlogManager()
# 
#     content_panels = Page.content_panels + getattr(Blog, 'content_panels', [])
#     settings_panels = Page.settings_panels + getattr(Blog, 'settings_panels', [])
# 
#     subpage_types = ['puput.EntryPage']
# 
#     def get_entries(self):
#         return EntryPage.objects.descendant_of(self).live().order_by('-date').select_related('owner')
# 
#     def get_context(self, request, *args, **kwargs):
#         context = super(BlogPage, self).get_context(request, *args, **kwargs)
#         context['entries'] = self.entries
#         context['blog_page'] = self
#         context['search_type'] = getattr(self, 'search_type', "")
#         context['search_term'] = getattr(self, 'search_term', "")
#         return context
# 
#     @property
#     def last_url_part(self):
#         """
#         Get the BlogPage url without the domain
#         """
#         return self.get_url_parts()[-1]
# 
#     class Meta:
#         verbose_name = _('Blog')


# Path: puput/feeds.py
from mimetypes import guess_type
from urllib.parse import urljoin
from django import http
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from django.template.defaultfilters import truncatewords_html
from wagtail.core.models import Site
from .models import BlogPage
        from .urls import get_entry_url

        if request.resolver_match.url_name == 'blog_page_feed_slug':
            self.blog_page = BlogPage.extra.get_by_path(kwargs['blog_path'])
            if not self.blog_page:
                raise http.Http404
        else:
            self.blog_page = BlogPage.objects.first()
        self.request = request
        return super(BlogPageFeed, self).__call__(request, *args, **kwargs)

    def title(self):
        return self.blog_page.title

    def description(self):
        return self.blog_page.description

    def link(self):
        return self.blog_page.last_url_part

    def items(self):
        return self.blog_page.get_entries()[:20]

    def item_title(self, item):
        return item.title

    def _item_short_description(self, item):
        if item.excerpt and item.excerpt.strip() != '':
            return item.excerpt
        else:
            return truncatewords_html(item.body, 70)


    def item_description(self, item):