blob: 011cee563fa969b15f58933c32ae0a7f662cbe19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.core.urlresolvers import reverse
from django.utils.html import strip_tags
from news.models import News
class NewsFeed(Feed):
title = "sublab.org news"
description = "the latest news from your sublab"
def link(self):
return reverse(self)
def items(self):
return News.objects.order_by('-date_updated')[:10]
def item_author_name(self, item):
return item.author
def item_description(self, item):
return strip_tags(item.content_html)
def item_title(self, item):
return item.title
def item_pubdate(self, item):
return item.date_created
class NewsFeedAtom(NewsFeed):
feed_type = Atom1Feed
subtitle = NewsFeed.description
|