comparison gpp/forums/feeds.py @ 385:2a03c69792d8

For #187; tune forums RSS settings. Set TTL to 1 hour; return 30 forum posts instead of 10; cache feed for 15 minutes instead of an hour.
author Brian Neal <bgneal@gmail.com>
date Wed, 16 Mar 2011 02:13:38 +0000
parents 9b63ad1f2ad2
children b15726767ab8
comparison
equal deleted inserted replaced
384:957955279a15 385:2a03c69792d8
10 10
11 11
12 class ForumsFeed(Feed): 12 class ForumsFeed(Feed):
13 """The Feed class for a specific forum""" 13 """The Feed class for a specific forum"""
14 14
15 ttl = '720' 15 ttl = '60'
16 author_name = 'Brian Neal' 16 author_name = 'Brian Neal'
17 author_email = 'admin@surfguitar101.com' 17 author_email = 'admin@surfguitar101.com'
18 18
19 def get_object(self, request, forum_slug): 19 def get_object(self, request, forum_slug):
20 # only return public forums 20 # only return public forums
57 # return a combined feed of public forum threads 57 # return a combined feed of public forum threads
58 items = Post.objects.filter( 58 items = Post.objects.filter(
59 topic__forum__in=Forum.objects.public_forums()) 59 topic__forum__in=Forum.objects.public_forums())
60 else: 60 else:
61 items = Post.objects.filter(topic__forum__id=obj.id) 61 items = Post.objects.filter(topic__forum__id=obj.id)
62 return items.order_by('-creation_date').select_related()[:10] 62 return items.order_by('-creation_date').select_related()[:30]
63 63
64 def item_title(self, item): 64 def item_title(self, item):
65 return item.topic.name 65 return item.topic.name
66 66
67 def item_description(self, item): 67 def item_description(self, item):