+class UserReputationSort(pagination.SimpleSort):\r
+ def apply(self, objects):\r
+ return objects.order_by('-is_active', self.order_by)\r
+\r
+class UserListPaginatorContext(pagination.PaginatorContext):\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=pagesizes)\r
+\r
+class SubscriptionListPaginatorContext(pagination.PaginatorContext):\r
+ def __init__(self):\r
+ super (SubscriptionListPaginatorContext, self).__init__('SUBSCRIPTION_LIST', pagesizes=(5, 10, 20), default_pagesize=20)\r
+\r
+class UserAnswersPaginatorContext(pagination.PaginatorContext):\r
+ def __init__(self):\r
+ super (UserAnswersPaginatorContext, self).__init__('USER_ANSWER_LIST', sort_methods=(\r
+ (_('oldest'), pagination.SimpleSort(_('oldest answers'), 'added_at', _("oldest answers will be shown first"))),\r
+ (_('newest'), pagination.SimpleSort(_('newest answers'), '-added_at', _("newest answers will be shown first"))),\r
+ (_('votes'), pagination.SimpleSort(_('popular answers'), '-score', _("most voted answers will be shown first"))),\r
+ ), default_sort=_('votes'), pagesizes=(5, 10, 20), default_pagesize=20, prefix=_('answers'))\r
+\r