Commit 2c191c6d authored by fred's avatar fred
Browse files

misc: include tags as dc:subject in podcast feed

parent 3d6d245c
......@@ -20,7 +20,7 @@ from django.core.paginator import Paginator
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed, add_domain
from django.utils.feedgenerator import Atom1Feed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
from haystack.query import SearchQuerySet
from jsonresponse import to_json
......@@ -653,11 +653,22 @@ class NewsItemDetailView(DetailView):
newsitem = NewsItemDetailView.as_view()
class RssCustomPodcastsFeed(Rss201rev2Feed):
def root_attributes(self):
attrs = super(RssCustomPodcastsFeed, self).root_attributes()
attrs['xmlns:dc'] = ''
return attrs
def add_item_elements(self, handler, item):
super(RssCustomPodcastsFeed, self).add_item_elements(handler, item)
for tag in item.get('tags') or []:
handler.addQuickElement('dc:subject', tag)
class PodcastsFeed(Feed):
title = 'Radio Panik - Podcasts'
link = '/'
description_template = 'feed/soundfile.html'
feed_type = RssCustomPodcastsFeed
def items(self):
return SoundFile.objects.select_related().filter(
......@@ -688,6 +699,9 @@ class PodcastsFeed(Feed):
def item_pubdate(self, item):
return item.creation_timestamp
def item_extra_kwargs(self, item):
return {'tags': [ for x in item.episode.tags.all()]}
podcasts_feed = PodcastsFeed()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment