comparison 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
comparison
equal deleted inserted replaced
580:c525f3e0b5d0 581:ee87ea74d46b
1 """
2 This file contains the feed classes for the news application.
3 """
4 from django.contrib.syndication.views import Feed
5
6 from news.models import Story
7 from core.functions import get_full_name
8 from core.functions import copyright_str
9
10
11 class LatestNewsFeed(Feed):
12 """The Feed class for the news application"""
13
14 title = 'SurfGuitar101.com News Feed'
15 link = '/feeds/news/'
16 description = 'News articles and stories from SurfGuitar101.com'
17 ttl = '720'
18 author_name = 'Brian Neal'
19 author_email = 'admin@surfguitar101.com'
20
21 def feed_copyright(self):
22 return copyright_str()
23
24 def items(self):
25 return Story.objects.order_by('-date_submitted')[:5]
26
27 def item_title(self, item):
28 return item.title
29
30 def item_description(self, item):
31 return item.short_text + item.long_text
32
33 def item_author_name(self, item):
34 return get_full_name(item.submitter)
35
36 def item_pubdate(self, item):
37 return item.date_submitted
38
39 def item_categories(self, item):
40 return (item.category.title, )