Djangoでブログを書く(四)Rss購読を書く
urlsでpyに'''を追加
from blog.feed import LatestEntriesFeed (r'^latest/feed/$', LatestEntriesFeed()),
from blog.feed import LatestEntriesFeed (r'^latest/feed/$', LatestEntriesFeed()),
#LatestEntriesFeed.py
from django.contrib.syndication.views import Feed
from blog.core.models import Essay
class LatestEntriesFeed(Feed):
#
title = u" "
link = "/feeds/"
#
description = " "
#
def items(self):
return Essay.objects.order_by('-pub_date')[:5]
#
def item_title(self, item):
return item.title
#
def item_description(self, item):
return item.abstract
#
def item_link(self,item):
return "xgjava.com/essay/"+str(item.id)+"/"