]> git.openstreetmap.org Git - osqa.git/commitdiff
Some fixes around pagination.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 May 2011 02:17:49 +0000 (02:17 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 26 May 2011 02:17:49 +0000 (02:17 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1047 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py
forum/views/users.py

index 67d2c38d94e5d6486b7997eacca7dd7873878117..9efdf07902449e7abf80e51fa650c252e0e5479e 100644 (file)
@@ -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 <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)
+        ), pagesizes=pagesizes, default_pagesize=default_pagesize, prefix=prefix)
 
 class AnswerSort(pagination.SimpleSort):
     def apply(self, answers):
index e6abdc488987f70694d8b989b043f253783d3ccd..8441f96dd64fd1b169753d0007fcfa9127f29af2 100644 (file)
@@ -35,13 +35,13 @@ class UserReputationSort(pagination.SimpleSort):
         return objects.order_by('-is_active', self.order_by)\r
 \r
 class UserListPaginatorContext(pagination.PaginatorContext):\r
-    def __init__(self):\r
+    def __init__(self, pagesizes=(20, 35, 60)):\r
         super (UserListPaginatorContext, self).__init__('USERS_LIST', sort_methods=(\r
             (_('reputation'), UserReputationSort(_('reputation'), '-reputation', _("sorted by reputation"))),\r
             (_('newest'), pagination.SimpleSort(_('recent'), '-date_joined', _("newest members"))),\r
             (_('last'), pagination.SimpleSort(_('oldest'), 'date_joined', _("oldest members"))),\r
             (_('name'), pagination.SimpleSort(_('by username'), 'username', _("sorted by username"))),\r
-        ), pagesizes=(20, 35, 60))\r
+        ), pagesizes=pagesizes)\r
 \r
 class SubscriptionListPaginatorContext(pagination.PaginatorContext):\r
     def __init__(self):\r