]> git.openstreetmap.org Git - osqa.git/blob - osqa/forum/feed.py
initial import
[osqa.git] / osqa / forum / feed.py
1 #!/usr/bin/env python
2 #encoding:utf-8
3 #-------------------------------------------------------------------------------
4 # Name:        Syndication feed class for subsribtion
5 # Purpose:
6 #
7 # Author:      Mike
8 #
9 # Created:     29/01/2009
10 # Copyright:   (c) CNPROG.COM 2009
11 # Licence:     GPL V2
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 = settings.APP_TITLE + _(' - ')+ _('latest questions')
19     link = settings.APP_URL #+ '/' + _('question/')
20     description = settings.APP_DESCRIPTION
21     #ttl = 10
22     copyright = settings.APP_COPYRIGHT
23
24     def item_link(self, item):
25         return self.link + item.get_absolute_url()
26
27     def item_author_name(self, item):
28         return item.author.username
29
30     def item_author_link(self, item):
31         return item.author.get_profile_url()
32
33     def item_pubdate(self, item):
34         return item.added_at
35
36     def items(self, item):
37        return Question.objects.filter(deleted=False).order_by('-last_activity_at')[:30]
38
39 def main():
40     pass
41
42 if __name__ == '__main__':
43     main()