Mercurial > public > sg101
diff news/feeds.py @ 581:ee87ea74d46b
For Django 1.4, rearranged project structure for new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 May 2012 17:10:48 -0500 |
parents | gpp/news/feeds.py@b4305e18d3af |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/news/feeds.py Sat May 05 17:10:48 2012 -0500 @@ -0,0 +1,40 @@ +""" +This file contains the feed classes for the news application. +""" +from django.contrib.syndication.views import Feed + +from news.models import Story +from core.functions import get_full_name +from core.functions import copyright_str + + +class LatestNewsFeed(Feed): + """The Feed class for the news application""" + + title = 'SurfGuitar101.com News Feed' + link = '/feeds/news/' + description = 'News articles and stories from SurfGuitar101.com' + ttl = '720' + author_name = 'Brian Neal' + author_email = 'admin@surfguitar101.com' + + def feed_copyright(self): + return copyright_str() + + def items(self): + return Story.objects.order_by('-date_submitted')[:5] + + def item_title(self, item): + return item.title + + def item_description(self, item): + return item.short_text + item.long_text + + def item_author_name(self, item): + return get_full_name(item.submitter) + + def item_pubdate(self, item): + return item.date_submitted + + def item_categories(self, item): + return (item.category.title, )