Commit 3faee8fe authored by stef's avatar stef

[enh] added atom/rss feeds

parent d1fed80b
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from bt.models import Violation
class RssSiteNewsFeed(Feed):
title = "NNMON - Latest NN Infringements"
link = "/"
description = "Latest submissions on network neutrality infringements across Europe"
description_template = 'feeditem.html'
def items(self):
return Violation.objects.filter(activationid='').order_by('-id')[:10]
def item_link(self, item):
return "/view/%s" %
def item_title(self, item):
return "%s (%s) %s" % (item.operator,, item.contract)
class AtomSiteNewsFeed(RssSiteNewsFeed):
feed_type = Atom1Feed
subtitle = RssSiteNewsFeed.description
......@@ -8,6 +8,8 @@
<meta name="keywords" content="internet network neutrality" />
<title>{% block title %}[!] NNMon {% endblock %}</title>
<meta name="robots" content="noarchive,noindex,nofollow">
<link rel="alternate" type="application/atom+xml" title="Atom feed" href="/atom/">
<link rel="alternate" type="application/rss+xml" title="RSS feed" href="/rss/">
{% block rss %}
{% endblock %}
{% block scripts %}
{% load bt %}
{% load babel %}
{% load i18n %}
{%if obj.comment_set.all.0%}
<h3>{%trans "Description" %}</h3>
<div class="description-node">
<div class="description">{{obj.comment_set.all.0.comment|safe}}</div>
<span class="submitter">Submitter: {%if obj.comment_set.all.0.submitter_name%}{{obj.comment_set.all.0.submitter_name}}{%else%}{{obj.comment_set.all.0.submitter_email}}{%endif%}</span> - <span class="comment_date">{{obj.comment_set.all.0.timestamp|datetimefmt:"short" }}</span>
{%if obj.comment_set.all.0.attachment_set.all%}
<div class="attachs">
{% trans "Attachments" %}
{%for a in obj.comment_set.all.0.attachment_set.all%}
<li><a href="{{}}">{{}}</a></li>
{%if}<li>{% trans "Media" %}: {{}}</li>{%endif%}
{%if obj.resource_name%}<li>{% trans "Affected Resource/service" %}: {{obj.resource_name}}</li>{%endif%}
{%if obj.type%}<li>{% trans "Type" %}: {{obj.type}}</li>{%endif%}
{%if obj.temporary%}<li>{% trans "Temporary restriction" %}: {% trans "yes" %}</li>{%endif%}
{%if obj.loophole%}<li>{% trans "Loophole offering" %}: {% trans yes %}}</li>{%endif%}
{%if obj.contractual%}<li>{% trans "Contractual restriction" %}: {% trans "yes" %}</li>{%endif%}
{%if obj.contract_excerpt%}{% trans "Contract excerpt" %}: {{obj.contract_excerpt|safe}}{%endif%}
......@@ -2,6 +2,8 @@ from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib import admin
from bt import views as bt
from bt.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
......@@ -11,6 +13,8 @@ urlpatterns = patterns('',
(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.ajax),
(r'^add/$', bt.add),
(r'^view/(?P<id>[0-9]*)$', bt.view),
(r'^rss/$', RssSiteNewsFeed()),
(r'^atom/$', AtomSiteNewsFeed()),
(r'^activate/$', bt.activate),
(r'^confirm/(?P<id>[0-9a-z]*)$', bt.confirm),
(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$', bt.confirm),
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