try:
from django.contrib.syndication.views import Feed, FeedDoesNotExist
+ old_version = False
except:
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
+ old_version = True
+from django.http import HttpResponse
from django.utils.translation import ugettext as _
from models import Question
from forum import settings
self._title = title
self._description = description
self._question_list = question_list
- self._url = request.path
+ self._url = request.path + "&" + "&".join(["%s=%s" % (k, v) for k, v in request.GET.items() if not k in ('page', 'pagesize', 'sort')])
+
+ if old_version:
+ super(RssQuestionFeed, self).__init__('', request)
def title(self):
return self._title
def item_pubdate(self, item):
return item.added_at
+ def item_categories(self, item):
+ return item.tagname_list()
+
def items(self, item):
return self._question_list[:30]
+
+ if old_version:
+ def __call__(self, request):
+ feedgen = self.get_feed('')
+ response = HttpResponse(mimetype=feedgen.mime_type)
+ feedgen.write(response, 'utf-8')
+ return response
+
{% block content %}\r
<div class="tabBar">\r
{% question_list_title %}\r
- <a style="float:left" href="{{ feed_url }}" title="{% trans "subscribe to question RSS feed" %}"><img src="{% media "media/images/feed-icon-small.png" %}" alt=""></a>\r
+ <a class="feed-icon" style="background-image:url('{% media "media/images/feed-icon-small.png" %}');" href="{{ feed_url }}" title="{% trans "subscribe to question RSS feed" %}"></a>\r
{% question_sort_tabs sort_context %}\r
</div>\r
<div id="listA">{% for question in questions %}\r
answer_description = _("answers")
if not feed_url:
- feed_url = request.path + "?type=rss"
+ req_params = "&".join(["%s=%s" % (k, v) for k, v in request.GET.items() if not k in ('page', 'pagesize', 'sort')])
+ if req_params:
+ req_params = '&' + req_params
+
+ feed_url = mark_safe(request.path + "?type=rss" + req_params)
return {
"questions" : questions,