Remove duplication on content page feed

This commit is contained in:
Jake Howard 2023-06-26 13:36:16 +01:00
parent c2150b66f3
commit bc9bdce31d
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -82,28 +82,16 @@ class AllPagesFeed(Feed):
return item.last_published_at return item.last_published_at
class ContentPageFeed(Feed): class ContentPageFeed(AllPagesFeed):
def __init__(self, posts: PageQuerySet, link: str, title: str): def __init__(self, posts: PageQuerySet, link: str, title: str):
self.posts = posts self.posts = posts
self.link = link self.link = link
self.title = title self.title = title
super().__init__() super().__init__()
def __call__(
self, request: HttpRequest, *args: list, **kwargs: dict
) -> HttpResponse:
self.request = request
return super().__call__(request, *args, **kwargs)
def items(self) -> PageQuerySet: def items(self) -> PageQuerySet:
return self.posts return self.posts
def item_title(self, item: BaseContentPage) -> str:
return item.title
def item_link(self, item: BaseContentPage) -> str:
return item.get_full_url(request=self.request)
def item_description(self, item: BaseContentPage) -> str: def item_description(self, item: BaseContentPage) -> str:
return item.summary return item.summary