Files
@ 71f773159ed4
Branch filter:
Location: website/www/conservancy/feeds.py - annotation
71f773159ed4
898 B
text/x-python
s/conservancy.softwarefreedom.org/sfconservancy.org/g
c858e825c0f2 12780197e5df c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 c858e825c0f2 | from django.contrib.syndication.feeds import Feed
from conservancy.apps.news.models import PressRelease
from django.shortcuts import render_to_response
from django.conf import settings
import datetime
class PressReleaseFeed(Feed):
title = "Software Freedom Conservancy News"
link = "/news/"
description = ""
def items(self):
return PressRelease.objects.filter(pub_date__lte=datetime.datetime.now(),
sites__id__exact=settings.SITE_ID).order_by('-pub_date')[:10]
def item_pubdate(self, item):
return item.pub_date
feed_dict = {
'news': PressReleaseFeed,
}
# make each feed know its canonical url
for k, v in feed_dict.items():
v.get_absolute_url = '/feeds/%s/' % k
def view(request):
"""Listing of all available feeds
"""
return render_to_response("feeds.html", {'feeds': feed_dict.values()})
|