##// END OF EJS Templates
Show only several last items in the RSS feed.
neko259 -
r189:bd4cb780 default
parent child Browse files
Show More
@@ -6,6 +6,8 b' from neboard import settings'
6 6
7 7 __author__ = 'neko259'
8 8
9 MAX_ITEMS = 20
10
9 11
10 12 class AllThreadsFeed(Feed):
11 13 title = settings.SITE_NAME + ' - All threads'
@@ -13,7 +15,7 b' class AllThreadsFeed(Feed):'
13 15 description_template = 'boards/rss/post.html'
14 16
15 17 def items(self):
16 return Post.objects.get_threads(order_by='-pub_time')
18 return Post.objects.get_threads(order_by='-pub_time')[:MAX_ITEMS]
17 19
18 20 def item_title(self, item):
19 21 return item.title
@@ -30,7 +32,7 b' class TagThreadsFeed(Feed):'
30 32 description_template = 'boards/rss/post.html'
31 33
32 34 def items(self, obj):
33 return Post.objects.get_threads(tag=obj, order_by='-pub_time')
35 return Post.objects.get_threads(tag=obj, order_by='-pub_time')[:MAX_ITEMS]
34 36
35 37 def get_object(self, request, tag_name):
36 38 return get_object_or_404(Tag, name=tag_name)
@@ -53,7 +55,7 b' class ThreadPostsFeed(Feed):'
53 55 description_template = 'boards/rss/post.html'
54 56
55 57 def items(self, obj):
56 return Post.objects.get_thread(opening_post_id=obj)
58 return Post.objects.get_thread(opening_post_id=obj)[:MAX_ITEMS]
57 59
58 60 def get_object(self, request, post_id):
59 61 return post_id
General Comments 0
You need to be logged in to leave comments. Login now