Modified render_template and renamed it to render_response (consistent with
[archweb_dev-nj.git] / feeds.py
blob84542fa6f024eb751c9372bee492ff4ac3d9422a
1 from django.contrib.syndication.feeds import Feed
2 from archweb_dev.packages.models import Package
3 from archweb_dev.news.models import News
4 #from datetime import datetime
6 class PackageFeed(Feed):
7 title = 'Recent Package Updates'
8 link = '/packages/'
9 description = 'Recent Package Updates'
11 def items(self):
12 return Package.objects.order_by('-last_update')[:10]
14 def item_pubdate(self, item):
15 return item.last_update
17 def item_categories(self, item):
18 return (item.repo.name,item.category.category)
20 class NewsFeed(Feed):
21 title = 'Recent News Updates'
22 link = '/news/'
23 description = 'Recent News Updates'
25 def items(self):
26 return News.objects.order_by('-postdate', '-id')[:10]
28 def item_pubdate(self, item):
29 return item.postdate
31 def item_author_name(self, item):
32 return item.author.get_full_name()