This repository has been archived on 2023-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
python-blog/articles/views/feeds.py

25 lines
627 B
Python
Raw Normal View History

2020-08-16 19:24:31 +02:00
from django.contrib.syndication.views import Feed
from articles.models import Article
from blog import settings
class CompleteFeed(Feed):
title = "Gab's Notes"
link = settings.BLOG["base_url"]
description = settings.BLOG["description"]
def items(self):
return Article.objects.filter(status=Article.PUBLISHED).order_by(
"-published_at"
)[:15]
def item_title(self, item: Article):
return item.title
def item_description(self, item: Article):
return item.get_formatted_content()
def item_pubdate(self, item: Article):
return item.published_at