]> git.openstreetmap.org Git - osqa.git/blob - forum/feed.py
Fixes a compatibility error with the feed api from django 1.1 and 1.2.
[osqa.git] / forum / feed.py
1 try:
2     from django.contrib.syndication.views import Feed, FeedDoesNotExist
3 except:
4     from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
5
6 from django.utils.translation import ugettext as _
7 from models import Question
8 from forum import settings
9
10
11 class RssQuestionFeed(Feed):
12     copyright = settings.APP_COPYRIGHT
13
14     def __init__(self, question_list, title, description, request):
15         self._title = title
16         self._description = description
17         self._question_list = question_list
18         self._url = request.path
19
20     def title(self):
21         return self._title
22
23     def link(self):
24         return self._url
25
26     def item_link(self, item):
27         return item.get_absolute_url()
28
29     def item_author_name(self, item):
30         return item.author.username
31
32     def item_author_link(self, item):
33         return item.author.get_profile_url()
34
35     def item_pubdate(self, item):
36         return item.added_at
37
38     def items(self, item):
39        return self._question_list[:30]