addons-server/apps/devhub/feeds.py

39 строки
1.0 KiB
Python
Исходник Обычный вид История

2010-11-11 20:58:10 +03:00
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from django.utils.feedgenerator import Rss201rev2Feed as RSS
2011-06-30 22:17:20 +04:00
import amo
2010-11-11 20:58:10 +03:00
from amo.helpers import absolutify, url, strip_html
from devhub.models import ActivityLog, RssKey
class ActivityFeedRSS(Feed):
feed_type = RSS
def get_object(self, request):
rsskey = request.GET.get('privaterss')
key = get_object_or_404(RssKey, key=rsskey)
return key
def items(self, key):
if key.addon:
addons = key.addon
else: # We are showing all the add-ons.
addons = key.user.addons.all()
2011-06-30 22:17:20 +04:00
return (ActivityLog.objects.for_addons(addons)
.exclude(action__in=amo.LOG_HIDE_DEVELOPER))[:20]
2010-11-11 20:58:10 +03:00
def item_title(self, item):
return strip_html(item.to_string())
def link(self):
"""Link for the feed as a whole"""
return absolutify(url('devhub.feed_all'))
def item_link(self):
return self.link()
2011-07-16 02:25:19 +04:00
def item_guid(self):
pass