From 39a548fd2629f3b6383990264b2e331b3aea99fb Mon Sep 17 00:00:00 2001 From: eliott Date: Sat, 3 Nov 2007 03:45:10 -0400 Subject: Initial import for public release... Special Note Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd! --- feeds.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 feeds.py (limited to 'feeds.py') diff --git a/feeds.py b/feeds.py new file mode 100644 index 00000000..bddf9419 --- /dev/null +++ b/feeds.py @@ -0,0 +1,29 @@ +from django.contrib.syndication.feeds import Feed +from archlinux.packages.models import Package +from archlinux.news.models import News +#from datetime import datetime + +class PackageFeed(Feed): + title = 'Recent Package Updates' + link = '/packages/' + description = 'Recent Package Updates' + + def items(self): + return Package.objects.order_by('-last_update')[:10] + + def item_pubdate(self, item): + return item.last_update + + def item_categories(self, item): + return (item.repo.name,item.category.category) + +class NewsFeed(Feed): + title = 'Recent News Updates' + link = '/news/' + description = 'Recent News Updates' + + def items(self): + return News.objects.order_by('-postdate', '-id')[:10] + + def item_pubdate(self, item): + return item.postdate -- cgit v1.2.3-55-g3dc8