]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blob - sommitrealweird/blog/feeds.py
Enable CSRF and Comment Moderation
[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 LatestBlogEntriesRss(Feed):
7     title = settings.BLOG_TITLE
8     description = u'Updates on %s' %(title,)
9     link = settings.BLOG_ROOT
10
11     title_template = 'blog/feeds/title.html'
12     description_template = 'blog/feeds/description.html'
13
14     def items(self):
15         try:
16             return BlogEntry.objects.filter(islive=True).order_by('-publish_date')[:20]
17         except:
18             return BlogEntry.objects.filter(islive=True).order_by('-publish_date')
19
20     def author_name(self, obj):
21         return "Brett Parker"
22
23     def author_email(self, obj):
24         return "iDunno@sommitrealweird.co.uk"
25
26     def item_author_name(self, obj):
27         return "Brett Parker"
28
29     def item_author_email(self, obj):
30         return "iDunno@sommitrealweird.co.uk"
31
32     def item_pubdate(self, obj):
33         return obj.publish_date
34
35 class LatestBlogEntries(LatestBlogEntriesRss):
36     feed_type = Atom1Feed
37     subtitle = LatestBlogEntriesRss.description