+class QuestionListPaginatorContext(pagination.PaginatorContext):
+ def __init__(self, id='QUESTIONS_LIST', prefix='', default_pagesize=30):
+ super (QuestionListPaginatorContext, self).__init__(id, sort_methods=(
+ (_('active'), pagination.SimpleSort(_('active'), '-last_activity_at', _("most recently updated questions"))),
+ (_('newest'), pagination.SimpleSort(_('newest'), '-added_at', _("most recently asked questions"))),
+ (_('hottest'), pagination.SimpleSort(_('hottest'), '-extra_count', _("hottest questions"))),
+ (_('mostvoted'), pagination.SimpleSort(_('most voted'), '-score', _("most voted questions"))),
+ ), pagesizes=(15, 30, 50), default_pagesize=default_pagesize, prefix=prefix)
+
+class AnswerPaginatorContext(pagination.PaginatorContext):
+ def __init__(self, id='ANSWER_LIST', prefix='', default_pagesize=10):
+ super (AnswerPaginatorContext, self).__init__(id, sort_methods=(
+ (_('oldest'), pagination.SimpleSort(_('oldest answers'), ('-marked', 'added_at'), _("oldest answers will be shown first"))),
+ (_('newest'), pagination.SimpleSort(_('newest answers'), ('-marked', '-added_at'), _("newest answers will be shown first"))),
+ (_('votes'), pagination.SimpleSort(_('popular answers'), ('-marked', '-score', 'added_at'), _("most voted answers will be shown first"))),
+ ), default_sort=_('votes'), pagesizes=(5, 10, 20), default_pagesize=default_pagesize, prefix=prefix)
+
+class TagPaginatorContext(pagination.PaginatorContext):
+ def __init__(self):
+ super (TagPaginatorContext, self).__init__('TAG_LIST', sort_methods=(
+ (_('name'), pagination.SimpleSort(_('by name'), 'name', _("sorted alphabetically"))),
+ (_('used'), pagination.SimpleSort(_('by popularity'), '-used_count', _("sorted by frequency of tag use"))),
+ ), default_sort=_('used'), pagesizes=(30, 60, 120))
+
+
+def feed(request):
+ return RssQuestionFeed(
+ request,
+ Question.objects.filter_state(deleted=False).order_by('-last_activity_at'),
+ settings.APP_TITLE + _(' - ')+ _('latest questions'),
+ settings.APP_DESCRIPTION)(request)
+