]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blob - sommitrealweird/blog/feeds.py
be04190f7b07d19f52b3d8699895cb82ffe864e5
[sommitrealweird.git] / sommitrealweird / blog / feeds.py
1 from django.contrib.syndication.feeds import Feed
2 from django.utils.feedgenerator import Atom1Feed
3 from blog.models import BlogEntry
4 from django.conf import settings
5
6 class LatestBlogEntries(Feed):
7     feed_type = Atom1Feed
8     title = settings.BLOG_TITLE
9     description = u'Updates on %s' %(title,)
10     link = settings.BLOG_ROOT
11
12     title_template = 'blog/feeds/title.html'
13     description_template = 'blog/feeds/description.html'
14
15     def items(self):
16         try:
17             return BlogEntry.objects.all().order_by('-publish_date')[:20]
18         except:
19             return BlogEntry.objects.all().order_by('-publish_date')
20
21     def author_name(self, obj):
22         return "Brett Parker"
23
24     def author_email(self, obj):
25         return "iDunno@sommitrealweird.co.uk"
26
27     def item_pubdate(self, obj):
28         return obj.publish_date