summaryrefslogtreecommitdiff
path: root/blog/feeds.py
blob: ae7d522c062b052e7218fa175f6dc97a1e8cbb6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from django.contrib.syndication.views import Feed
from django.utils.translation import gettext_lazy as _

from .models import Entry


class WeblogEntryFeed(Feed):
    title = _("The Django weblog")
    link = "https://www.djangoproject.com/weblog/"
    description = _("Latest news about Django, the Python web framework.")

    def items(self):
        return Entry.objects.published()[:10]

    def item_pubdate(self, item):
        return item.pub_date

    def item_author_name(self, item):
        return item.author

    def item_description(self, item):
        return item.body_html