Commit 60d49798 authored by fred's avatar fred

add rss & atom feeds for news items

parent 8be4ae2a
......@@ -22,10 +22,12 @@ urlpatterns = patterns('',
url(r'^listen/$', 'panikweb.search.listenArchives', name='listen'),
url(r'^news/$', 'panikweb.views.news', name='news'),
url(r'^news/archives/$', 'panikweb.views.newsArchives', name='newsArchives'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='news-view'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='newsitem-view'),
url(r'^search/', 'panikweb.search.view', name='search'),
url(r'^news.rss', 'panikweb.views.rss_news_feed', name='rss-feed'),
url(r'^news.atom', 'panikweb.views.atom_news_feed', name='atom-feed'),
url(r'^podcasts.rss', 'panikweb.views.podcasts_feed', name='podcasts-feed'),
url(r'^newsletter/', include('newsletter.urls')),
......
......@@ -10,6 +10,9 @@ from django.views.generic.dates import _date_from_string
from django.core.paginator import Paginator
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
import fiber.views
from haystack.query import SearchQuerySet
from jsonresponse import to_json
......@@ -559,3 +562,20 @@ class FiberPageView(fiber.views.FiberTemplateView):
context['sectionName'] = 'About'
return context
fiber_page = FiberPageView.as_view()
class RssNewsFeed(Feed):
title = 'Radio Panik'
link = '/news/'
description_template = 'news/feed.html'
def items(self):
return NewsItem.objects.order_by('-date')[:10]
rss_news_feed = RssNewsFeed()
class AtomNewsFeed(RssNewsFeed):
feed_type = Atom1Feed
atom_news_feed = AtomNewsFeed()
......@@ -36,7 +36,7 @@
<ul class="news columns padded list custom">
{% for NewsItem in newsAll %}
<li class="item ellipsis small ">
<a href="{% url 'news-view' slug=NewsItem.slug %}">
<a href="{% url 'newsitem-view' slug=NewsItem.slug %}">
<span class="title"><strong>{{ NewsItem.date|date:"D m/M" }}</strong>&nbsp;-&nbsp;{{ NewsItem.title }}</span>
</a>
</li>
......
{% load thumbnails %}
{% if obj.image %}
<img src="{{ obj.image|thumbnail:'320x240' }}"/>
{% endif %}
{{ obj.text }}
{% load thumbnails %}
{% load staticfiles %}
<div class="content content-inline {% if class != "special" %}inline{% endif %} cf {{ class }}">
<a class="block cf" href="{% url 'news-view' slug=content.slug %}">
<a class="block cf" href="{% url 'newsitem-view' slug=content.slug %}">
<div class="logo">
{% if class == "special" and content.image %}
<img class="nomal" src="{{ content.image|thumbnail:'320x240' }}"/>
......
......@@ -4,7 +4,7 @@
<ul class="custom">
{% for content in news %}
<li class="{% if forloop.counter == 1 %}first{% endif %}">
<a class="block news relative" href="{% url 'news-view' slug=content.slug %}">
<a class="block news relative" href="{% url 'newsitem-view' slug=content.slug %}">
{% if forloop.counter == 1 %}
<img class="logo" src="{{ content.image|thumbnail:'640x480' }}"/>
......
<a href="{% url 'news-view' slug=result.slug %}">
<a href="{% url 'newsitem-view' slug=result.slug %}">
<span class="icon-bullhorn" ></span>
<strong>{{ result.title }}</strong>
{% if result.date %}
......
Markdown is supported
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