3 #-------------------------------------------------------------------------------
4 # Name: Syndication feed class for subsribtion
10 # Copyright: (c) CNPROG.COM 2009
12 #-------------------------------------------------------------------------------
13 from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
14 from django.utils.translation import ugettext as _
15 from models import Question
16 from django.conf import settings
17 class RssLastestQuestionsFeed(Feed):
18 title = str(settings.APP_TITLE) + _(' - ')+ _('latest questions')
19 link = settings.APP_URL #+ '/' + _('question/')
20 description = settings.APP_DESCRIPTION
22 copyright = settings.APP_COPYRIGHT
24 def item_link(self, item):
25 return self.link + item.get_absolute_url()
27 def item_author_name(self, item):
28 return item.author.username
30 def item_author_link(self, item):
31 return item.author.get_profile_url()
33 def item_pubdate(self, item):
36 def items(self, item):
37 return Question.objects.filter(deleted=None).order_by('-last_activity_at')[:30]
42 if __name__ == '__main__':