summaryrefslogtreecommitdiffstats
path: root/feeds.py
diff options
context:
space:
mode:
authorIsmael Carnales <icarnales@gmail.com>2009-10-30 19:24:26 -0200
committerIsmael Carnales <icarnales@gmail.com>2009-11-09 22:24:44 -0200
commit19f0a3fb57e53977d1f2017033f0714a8cfc8779 (patch)
treecdce7728ceec7202086f0cd7605a496887ee0afe /feeds.py
parent046b4543a4ceaf4cfe6736443d4a7e453b5bf14b (diff)
downloadarchweb-19f0a3fb57e53977d1f2017033f0714a8cfc8779.tar.gz
archweb-19f0a3fb57e53977d1f2017033f0714a8cfc8779.zip
added feeds from archweb_pub
Diffstat (limited to 'feeds.py')
-rw-r--r--feeds.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/feeds.py b/feeds.py
new file mode 100644
index 00000000..cc6f3278
--- /dev/null
+++ b/feeds.py
@@ -0,0 +1,36 @@
+import datetime
+from django.contrib.syndication.feeds import Feed
+from archweb.main.models import Package, 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')[:24]
+
+ def item_pubdate(self, item):
+ return item.last_update
+
+ def item_categories(self, item):
+ return (item.repo.name,item.arch.name)
+
+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):
+ d = item.postdate
+ return datetime.datetime(d.year, d.month, d.day)
+
+ def item_author_name(self, item):
+ return item.author.get_full_name()
+
+# vim: set ts=4 sw=4 et:
+