gremmie@1: """ gremmie@1: This file contains the feed classes for the news application. gremmie@1: """ bgneal@176: from django.contrib.syndication.views import Feed bgneal@170: gremmie@1: from news.models import Story bgneal@176: from core.functions import get_full_name bgneal@176: from core.functions import copyright_str bgneal@170: gremmie@1: gremmie@1: class LatestNewsFeed(Feed): bgneal@170: """The Feed class for the news application""" gremmie@1: bgneal@170: title = 'SurfGuitar101.com News Feed' bgneal@170: link = '/feeds/news/' bgneal@170: description = 'News articles and stories from SurfGuitar101.com' bgneal@170: ttl = '720' bgneal@176: author_name = 'Brian Neal' bgneal@176: author_email = 'admin@surfguitar101.com' gremmie@1: bgneal@176: def feed_copyright(self): bgneal@176: return copyright_str() bgneal@170: bgneal@170: def items(self): bgneal@170: return Story.objects.order_by('-date_published')[:5] bgneal@170: bgneal@176: def item_title(self, item): bgneal@176: return item.title bgneal@176: bgneal@176: def item_description(self, item): bgneal@176: return item.short_text + item.long_text bgneal@176: bgneal@176: def item_author_name(self, item): bgneal@176: return get_full_name(item.submitter) bgneal@176: bgneal@170: def item_pubdate(self, item): bgneal@170: return item.date_published bgneal@170: bgneal@170: def item_categories(self, item): bgneal@170: return (item.category.title, )