evorepo/feeds.py

34 lines
911 B
Python
Raw Normal View History

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):
2007-11-06 17:43:41 -08:00
title = 'Recent Package Updates'
link = '/packages/'
description = 'Recent Package Updates'
2007-11-06 17:43:41 -08:00
def items(self):
return Package.objects.order_by('-last_update')[:10]
2007-11-06 17:43:41 -08:00
def item_pubdate(self, item):
return item.last_update
2007-11-06 17:43:41 -08:00
def item_categories(self, item):
return (item.repo.name,item.category.category)
class NewsFeed(Feed):
2007-11-06 17:43:41 -08:00
title = 'Recent News Updates'
link = '/news/'
description = 'Recent News Updates'
2007-11-06 17:43:41 -08:00
def items(self):
return News.objects.order_by('-postdate', '-id')[:10]
2007-11-06 17:43:41 -08:00
def item_pubdate(self, item):
return item.postdate
2007-11-06 17:36:53 -08:00
def item_author_name(self, item):
2007-11-17 10:30:23 -08:00
return item.author.get_full_name()
2007-11-06 17:36:53 -08:00