aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/journal/feeds.py
blob: 09f1a4e6fa67f3213dd0ef670977ad4909a612ed (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from django.contrib.syndication.feeds import Feed
from models import Entry, MicroEntry, LinkArtifact


class LatestEntries(Feed):
    title = "bnewbold.net journal entries"
    link = "/journal/entries/"
    description = " "

    def items(self):
        return Entry.objects.order_by('-date')[:5]

    def item_link(self,item):
        return "http://bnewbold.net%s" % item.get_absolute_url()

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

    def item_author_email(self,item):
        return item.author.email

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

class LatestMicroEntries(Feed):
    title = "bnewbold.net microentries"
    link = "/journal/microentries/"
    description = "Quick updates"

    def items(self):
        return MicroEntry.objects.order_by('-date')[:5]

    def item_link(self,item):
        return "http://bnewbold.net%s" % item.get_absolute_url()

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

    def item_author_email(self,item):
        return item.author.email

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

class LatestLinks(Feed):
    title = "bnewbold.net links"
    link = "/artifacts/links/"
    description = "Links to love"

    def items(self):
        return LinkArtifact.objects.order_by('-date')[:5]

    def item_link(self,item):
        return item.url

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

    def item_author_email(self,item):
        return item.author.email

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

feed_list = {'latest_entries':LatestEntries,
             'latest_microentries':LatestMicroEntries,
             'latest_links':LatestLinks }