blob: 373f8a87c08bd01cb9819e3f8089591ae7b7a092 (
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
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env python
#encoding:utf-8
#-------------------------------------------------------------------------------
# Name: Syndication feed class for subsribtion
# Purpose:
#
# Author: Mike
#
# Created: 29/01/2009
# Copyright: (c) CNPROG.COM 2009
# Licence: GPL V2
#-------------------------------------------------------------------------------
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
from django.utils.translation import ugettext as _
from models import Question
import settings
class RssLastestQuestionsFeed(Feed):
title = settings.APP_TITLE + _(' - ')+ _('latest questions')
link = settings.APP_URL + '/' + _('questions/')
description = settings.APP_DESCRIPTION
#ttl = 10
copyright = settings.APP_COPYRIGHT
def item_link(self, item):
return self.link + '%s/' % item.id
def item_author_name(self, item):
return item.author.username
def item_author_link(self, item):
return item.author.get_profile_url()
def item_pubdate(self, item):
return item.added_at
def items(self, item):
return Question.objects.filter(deleted=False).order_by('-added_at')[:30]
def main():
pass
if __name__ == '__main__':
main()
|