forked from DmitriiP/agora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.py
26 lines (20 loc) · 780 Bytes
/
feed.py
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
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from agora.models import Post
from agora.views import post
class LatestEntriesFeed(Feed):
title = "Hack news feed"
link = "/new/"
description = "Updates on changes and additions to hack news"
def items(self):
return Post.objects.order_by('-timestamp')[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.text
# item_link is only needed if NewsItem has no get_absolute_url method.
def item_link(self, item):
# return reverse(post, args=[item.pk])
return "http://23.21.240.209:3000/post/%d" % item.pk
def link(self):
return "http://23.21.240.209:3000"