feeds.py 742 Bytes
Newer Older
stef's avatar
stef committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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