Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
Respect My Net
Commits
3faee8fe
Commit
3faee8fe
authored
Jul 04, 2011
by
stef
Browse files
[enh] added atom/rss feeds
parent
d1fed80b
Changes
4
Hide whitespace changes
Inline
Side-by-side
bt/feeds.py
0 → 100644
View file @
3faee8fe
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"
%
item
.
pk
def
item_title
(
self
,
item
):
return
"%s (%s) %s"
%
(
item
.
operator
,
item
.
country
,
item
.
contract
)
class
AtomSiteNewsFeed
(
RssSiteNewsFeed
):
feed_type
=
Atom1Feed
subtitle
=
RssSiteNewsFeed
.
description
templates/base.html
View file @
3faee8fe
...
...
@@ -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 %}
...
...
templates/feeditem.html
0 → 100644
View file @
3faee8fe
{% 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" %}
<ul>
{%for a in obj.comment_set.all.0.attachment_set.all%}
<li><a
href=
"{{a.storage.url}}"
>
{{a.storage.name}}
</a></li>
{%endfor%}
</ul>
</div>
{%endif%}
</div>
{%endif%}
<ul>
{%if obj.media%}
<li>
{% trans "Media" %}: {{obj.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%}
</ul>
{%if obj.contract_excerpt%}{% trans "Contract excerpt" %}: {{obj.contract_excerpt|safe}}{%endif%}
urls.py
View file @
3faee8fe
...
...
@@ -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
admin
.
autodiscover
()
...
...
@@ -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
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment