Example #1
0
 def __init__(self, pagesizes=(20, 35, 60), default_pagesize=35):
     super (UserListPaginatorContext, self).__init__('USERS_LIST', sort_methods=(
         (_('reputation'), UserReputationSort(_('reputation'), '-reputation', _("sorted by reputation"))),
         (_('newest'), pagination.SimpleSort(_('recent'), '-date_joined', _("newest members"))),
         (_('last'), pagination.SimpleSort(_('oldest'), 'date_joined', _("oldest members"))),
         (_('name'), pagination.SimpleSort(_('by username'), 'username', _("sorted by username"))),
     ), pagesizes=pagesizes, default_pagesize=default_pagesize)
Example #2
0
 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 <strong>recently updated</strong> questions"))),
         (_('newest'), pagination.SimpleSort(_('newest'), '-added_at', _("most <strong>recently asked</strong> questions"))),
         (_('hottest'), HottestQuestionsSort(_('hottest'), _("most <strong>active</strong> questions in the last 24 hours</strong>"))),
         (_('mostvoted'), pagination.SimpleSort(_('most voted'), '-score', _("most <strong>voted</strong> questions"))),
     ), pagesizes=(15, 30, 50), default_pagesize=default_pagesize, prefix=prefix)
Example #3
0
 def __init__(self, id='QUESTIONS_LIST', prefix='', default_pagesize=100):
     super(NodeManagementPaginatorContext, self).__init__(
         id,
         sort_methods=(
             (_('added_at'),
              pagination.SimpleSort(_('added_at'), '-added_at', "")),
             (_('added_at_asc'),
              pagination.SimpleSort(_('added_at_asc'), 'added_at', "")),
             (_('author'),
              pagination.SimpleSort(_('author'), '-author__username', "")),
             (_('author_asc'),
              pagination.SimpleSort(_('author_asc'), 'author__username',
                                    "")),
             (_('score'), pagination.SimpleSort(_('score'), '-score', "")),
             (_('score_asc'),
              pagination.SimpleSort(_('score_asc'), 'score', "")),
             (_('act_at'),
              pagination.SimpleSort(_('act_at'), '-last_activity_at', "")),
             (_('act_at_asc'),
              pagination.SimpleSort(_('act_at_asc'), 'last_activity_at',
                                    "")),
             (_('act_by'),
              pagination.SimpleSort(_('act_by'),
                                    '-last_activity_by__username', "")),
             (_('act_by_asc'),
              pagination.SimpleSort(_('act_by_asc'),
                                    'last_activity_by__username', "")),
         ),
         pagesizes=(default_pagesize, ),
         force_sort='added_at',
         default_pagesize=default_pagesize,
         prefix=prefix)
Example #4
0
 def __init__(self,
              id='QUESTIONS_LIST',
              prefix='',
              pagesizes=(20, 50, 100),
              default_pagesize=100):
     super(QuestionListPaginatorContext, self).__init__(
         id,
         sort_methods=(
             (_('active'),
              pagination.SimpleSort(
                  _('Active'), '-last_activity_at',
                  _("Most <strong>recently updated</strong> lists"))),
             (_('trending'),
              HottestQuestionsSort(
                  _('Trending'),
                  _("most <strong>active</strong> lists in the last 24 hours</strong>"
                    ))),
             (_('newest'),
              pagination.SimpleSort(
                  _('Newest'), '-added_at',
                  _("most <strong>recently started</strong> lists"))),
             (_('mostvoted'),
              pagination.SimpleSort(
                  _('Most Voted'), '-score',
                  _("most <strong>voted</strong> lists"))),
         ),
         pagesizes=pagesizes,
         default_pagesize=default_pagesize,
         prefix=prefix)
Example #5
0
 def __init__(self):
     super (BadgesAwardCommentsPaginatorContext, self).__init__('BADGE_ANSWER_LIST', sort_methods=(
         (_('oldest'), pagination.SimpleSort(_('oldest answers'), 'awarded_at', _("oldest answers will be shown first"))),
         (_('newest'), pagination.SimpleSort(_('newest answers'), '-awarded_at', _("newest answers will be shown first"))),
         (_('receiver'), pagination.SimpleSort(_('by receiver'), 'user', _("sorted alphabetically by the peer who received the badge"))),
         (_('giver'), pagination.SimpleSort(_('by giver'), 'node__author', _("sorted alphabetically by the peer who gave the badge"))),
     ), default_sort=_('newest'), pagesizes=(5, 10, 20), default_pagesize=10, prefix=_('award_comments'))
Example #6
0
 def __init__(self):
     super (BadgesAnswersPaginatorContext, self).__init__('BADGE_ANSWER_LIST', sort_methods=(
         (_('oldest'), pagination.SimpleSort(_('oldest answers'), 'added_at', _("oldest answers will be shown first"))),
         (_('newest'), pagination.SimpleSort(_('newest answers'), '-added_at', _("newest answers will be shown first"))),
         (_('votes'), pagination.SimpleSort(_('popular answers'), '-score', _("most voted answers will be shown first"))),
         (_('author'), pagination.SimpleSort(_('by author'), 'author', _("sorted alphabetically by author"))),
     ), default_sort=_('votes'), pagesizes=(5, 10, 20), default_pagesize=10, prefix=_('answers'))
Example #7
0
 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))
Example #8
0
def question_search(request, keywords):
    rank_feed = False
    can_rank, initial = Question.objects.search(keywords)

    if can_rank:
        sort_order = None

        if isinstance(can_rank, basestring):
            sort_order = can_rank
            rank_feed = True

        paginator_context = QuestionListPaginatorContext()
        paginator_context.sort_methods[_('ranking')] = pagination.SimpleSort(
            _('relevance'), sort_order, _("most relevant questions"))
        paginator_context.force_sort = _('ranking')
    else:
        paginator_context = None

    feed_url = mark_safe(escape(request.path + "?type=rss&q=" + keywords))

    return question_list(
        request,
        initial,
        _("questions matching '%(keywords)s'") % {'keywords': keywords},
        None,
        _("questions matching '%(keywords)s'") % {'keywords': keywords},
        paginator_context=paginator_context,
        feed_url=feed_url,
        feed_sort=rank_feed and (can_rank, ) or '-added_at')
Example #9
0
 def __init__(self):
     super(UserAnswersPaginatorContext,
           self).__init__(
               'USER_ANSWER_LIST',
               sort_methods=(
                   (_('oldest'),
                    pagination.SimpleSort(
                        _('oldest'), 'added_at',
                        _("oldest answers will be shown first"))),
                   (_('newest'),
                    pagination.SimpleSort(
                        _('newest'), '-added_at',
                        _("newest answers will be shown first"))),
                   (_('votes'),
                    pagination.SimpleSort(
                        _('popular'), '-score',
                        _("most voted answers will be shown first"))),
               ),
               default_sort=_('votes'),
               pagesizes=(5, 20, 100),
               default_pagesize=5,
               prefix=_('answers'))
Example #10
0
def question_search(request, keywords):
    can_rank, initial = Question.objects.search(keywords)

    if can_rank:
        paginator_context = QuestionListPaginatorContext()
        paginator_context.sort_methods[_('ranking')] = pagination.SimpleSort(_('relevance'), '-ranking', _("most relevant questions"))
        paginator_context.force_sort = _('ranking')
    else:
        paginator_context = None

    return question_list(request, initial,
                         _("questions matching '%(keywords)s'") % {'keywords': keywords},
                         None,
                         _("questions matching '%(keywords)s'") % {'keywords': keywords},
                         paginator_context=paginator_context)
Example #11
0
def question_search(request, keywords):
    can_rank, initial = Question.objects.search(keywords)

    if can_rank:
        paginator_context = QuestionListPaginatorContext()
        paginator_context.sort_methods[_('ranking')] = pagination.SimpleSort(_('relevance'), '-ranking', _("most relevant questions"))
        paginator_context.force_sort = _('ranking')
    else:
        paginator_context = None

    feed_url = mark_safe(escape(request.path + "?type=rss&q=" + keywords))

    return question_list(request, initial,
                         _("questions matching '%(keywords)s'") % {'keywords': keywords},
                         None,
                         _("questions matching '%(keywords)s'") % {'keywords': keywords},
                         paginator_context=paginator_context,
                         feed_url=feed_url)
Example #12
0
 def __init__(self):
     super (BadgesPaginatorContext, self).__init__('BADGE_LIST', sort_methods=(
         (_('type'), pagination.SimpleSort(_('by type'), '-type', _("sorted by type of badge"))),
         (_('name'), pagination.SimpleSort(_('by name'), 'cls', _("sorted alphabetically by name"))),
         (_('award'), pagination.SimpleSort(_('by awards'), '-awarded_count', _("sorted by number of awards"))),
     ), default_sort=_('type'), pagesizes=(5, 10, 20), default_pagesize=20, prefix=_('badge'))