+ @property
+ def SORT(self):
+ return self.prefix and "%s_%s" % (self.prefix, _('sort')) or _('sort')
+
+page_numbers_template = template.loader.get_template('paginator/page_numbers.html')
+page_sizes_template = template.loader.get_template('paginator/page_sizes.html')
+sort_tabs_template = template.loader.get_template('paginator/sort_tabs.html')
+
+def paginated(request, paginators, tpl_context):
+ if len(paginators) == 2 and isinstance(paginators[0], basestring):
+ paginators = (paginators,)
+
+ for list_name, context in paginators:
+ tpl_context[list_name] = _paginated(request, tpl_context[list_name], context)
+
+ return tpl_context
+
+def _paginated(request, objects, context):
+ session_prefs = context.preferences(request)
+
+ pagesize = context.pagesize(request, session_prefs)
+ page = context.page(request)
+ sort, objects = context.sorted(objects, request, session_prefs)