From 3540ef931f8aaf061ea2d80bf5ac3fbca77fe35c Mon Sep 17 00:00:00 2001 From: hernani Date: Thu, 26 May 2011 02:17:49 +0000 Subject: [PATCH] Some fixes around pagination. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1047 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/views/readers.py | 4 ++-- forum/views/users.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/forum/views/readers.py b/forum/views/readers.py index 67d2c38..9efdf07 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -40,13 +40,13 @@ class HottestQuestionsSort(pagination.SortBase): class QuestionListPaginatorContext(pagination.PaginatorContext): - def __init__(self, id='QUESTIONS_LIST', prefix='', default_pagesize=30): + def __init__(self, id='QUESTIONS_LIST', prefix='', pagesizes=(15, 30, 50), 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'), HottestQuestionsSort(_('hottest'), _("most active questions in the last 24 hours"))), (_('mostvoted'), pagination.SimpleSort(_('most voted'), '-score', _("most voted questions"))), - ), pagesizes=(15, 30, 50), default_pagesize=default_pagesize, prefix=prefix) + ), pagesizes=pagesizes, default_pagesize=default_pagesize, prefix=prefix) class AnswerSort(pagination.SimpleSort): def apply(self, answers): diff --git a/forum/views/users.py b/forum/views/users.py index e6abdc4..8441f96 100644 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -35,13 +35,13 @@ class UserReputationSort(pagination.SimpleSort): return objects.order_by('-is_active', self.order_by) class UserListPaginatorContext(pagination.PaginatorContext): - def __init__(self): + def __init__(self, pagesizes=(20, 35, 60)): 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=(20, 35, 60)) + ), pagesizes=pagesizes) class SubscriptionListPaginatorContext(pagination.PaginatorContext): def __init__(self): -- 2.39.5