summaryrefslogtreecommitdiff
path: root/feeds.py
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2007-11-03 03:45:10 -0400
committereliott <eliott@cactuswax.net>2007-11-03 03:45:10 -0400
commit39a548fd2629f3b6383990264b2e331b3aea99fb (patch)
treef68c3156dad5f7814473ceff2461679ddf11a2e8 /feeds.py
Initial import for public release...
Special Note Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
Diffstat (limited to 'feeds.py')
-rw-r--r--feeds.py29
1 files changed, 29 insertions, 0 deletions
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