aboutsummaryrefslogtreecommitdiffstats
path: root/ryuslash/aggregator/feeds.py
blob: 7b841389d313f6965d2a63cfa0917c210435b9b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from django.contrib.syndication.views import Feed

from aggregator.models import Post


class LatestPostsFeed(Feed):
    title = "ryuslash's RSS feed"
    link = "/"
    description = "Updates by ryuslash"

    def items(self):
        return Post.objects.all()[:20]

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

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

    def item_link(self, item):
        return "/post/%d/" % item.pk

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