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