Skip to content
This repository was archived by the owner on May 23, 2020. It is now read-only.

Commit 2e7f50d

Browse files
committed
1 parent 63f309d commit 2e7f50d

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

update-1.1/blog/feed.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
11
from django.contrib.syndication.views import Feed
2+
from django.utils.feedgenerator import Rss201rev2Feed
3+
from django.core.urlresolvers import reverse
24
from .models import Entry
35

6+
class CorrectMimeTypeFeed(Rss201rev2Feed):
7+
mime_type = 'application/xml'
8+
49
class LatestPosts(Feed):
5-
title = "Q Blog"
6-
link = "/feed/"
7-
description = "Latest Posts of Q"
10+
feed_type = CorrectMimeTypeFeed
11+
12+
title = "Feed Blog Posts"
13+
link = "/feed/"
14+
description = "Latest Feed Blog Posts"
815

9-
def items(self):
10-
return Entry.objects.published()[:5]
16+
def author_name(self):
17+
return "Summon Agus"
18+
19+
def items(self):
20+
return Entry.objects.published()[:10]
21+
22+
def item_title(self, item):
23+
return item.title
24+
25+
def item_description(self, item):
26+
return item.body
27+
28+
def item_author_name(self, item):
29+
return item.author
30+
31+
def item_link(self, item):
32+
return reverse('entry_detail', args=[item.slug])
33+
34+
def item_pubdate(self, item):
35+
return item.modified

0 commit comments

Comments
 (0)