Initial import for public release...
[archweb_dev-nj.git] / feeds.py
blobbddf9419cb04c8407248a919161fd888a1fa2ba8
1 from django.contrib.syndication.feeds import Feed
2 from archlinux.packages.models import Package
3 from archlinux.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