比这篇新的文章:
求最大最小最大值因数
比这篇旧的文章: python.新浪读书频道下载合成txt小说
作者: 半瓶墨水, 点击563次, 评论(0), 收藏者(0)
打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: python.新浪读书频道下载合成txt小说
代码发芽网做RSS的两个类,Django做RSS真方便
语言: Python, 标签: RSS Django 2008/06/26发布 4个月前更新作者: 半瓶墨水, 点击563次, 评论(0), 收藏者(0)
Python语言: 代码发芽网做RSS的两个类,Django做RSS真方便
01 #coding=utf-8
02 #参照: http://www.djangoproject.com/documentation/syndication_feeds/
03
04 from django.contrib.syndication.feeds import Feed
05 from fayaa.coding.models import Codee, CodeeComment
06
07 class LatestCodees(Feed):
08 title = "代码发芽网最新代码"
09 link = "/code/feeds/codees/"
10 description = "来自代码发芽网( http://www.fayaa.com/code/ )的最新代码"
11
12 def items(self):
13 return Codee.objects.order_by('-create_time')[:15]
14
15 def item_link(self, item):
16 return "http://www.fayaa.com/code/view/%d/" % item.id
17
18 class LatestComments(Feed):
19 title = "代码发芽网最新评论"
20 link = "/code/feeds/comments/"
21 description = "来自代码发芽网(http://www.fayaa.com/code/)的最新评论"
22
23 def items(self):
24 return CodeeComment.objects.order_by('-create_time')[:15]
25
26 def item_link(self, item):
27 return "http://www.fayaa.com/code/view/%d/" % item.codee.id
02 #参照: http://www.djangoproject.com/documentation/syndication_feeds/
03
04 from django.contrib.syndication.feeds import Feed
05 from fayaa.coding.models import Codee, CodeeComment
06
07 class LatestCodees(Feed):
08 title = "代码发芽网最新代码"
09 link = "/code/feeds/codees/"
10 description = "来自代码发芽网( http://www.fayaa.com/code/ )的最新代码"
11
12 def items(self):
13 return Codee.objects.order_by('-create_time')[:15]
14
15 def item_link(self, item):
16 return "http://www.fayaa.com/code/view/%d/" % item.id
17
18 class LatestComments(Feed):
19 title = "代码发芽网最新评论"
20 link = "/code/feeds/comments/"
21 description = "来自代码发芽网(http://www.fayaa.com/code/)的最新评论"
22
23 def items(self):
24 return CodeeComment.objects.order_by('-create_time')[:15]
25
26 def item_link(self, item):
27 return "http://www.fayaa.com/code/view/%d/" % item.codee.id
所有评论,共0条:( 我也来说两句)
代码