view gpp/news/feeds.py @ 160:2eb3984ccb15

Implement #45, add a who's online feature for the forums. Created middleware that caches usernames and guest session ids in the cache. Added a tag that displays this info.
author Brian Neal <bgneal@gmail.com>
date Tue, 22 Dec 2009 02:08:05 +0000
parents dbd703f7d63a
children 6f14970b103a
line wrap: on
line source
"""
This file contains the feed classes for the news application.
"""

from django.contrib.syndication.feeds import Feed
from news.models import Story


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'
   copyright = 'Copyright (C) 2008, Brian Neal'
   ttl = '720'

   title_template = 'news/feed_title.html'
   description_template = 'news/feed_description.html'
   
   def items(self):
      return Story.objects.order_by('-date_published')[:5]

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

   def item_categories(self, item):
      return (item.category.title, )