summaryrefslogtreecommitdiff
path: root/feeds.py
blob: 8e16907acd08ee2a6adef3784668c74b83ca235c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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

    def item_author_name(self, item):
        return item.author.get_full_name