X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/b885b2a795c839540f299a7e5f33ed4b670101ab..af86787210acddeca6800db8e6e7106edd3973cc:/forum/utils/pagination.py?ds=sidebyside diff --git a/forum/utils/pagination.py b/forum/utils/pagination.py index a573954..5951b33 100644 --- a/forum/utils/pagination.py +++ b/forum/utils/pagination.py @@ -19,11 +19,11 @@ class SimpleSort(SortBase): super(SimpleSort, self) .__init__(label, description) self.order_by = order_by + def _get_order_by(self): + return isinstance(self.order_by, (list, tuple)) and self.order_by or [self.order_by] + def apply(self, objects): - if isinstance(self.order_by, (list, tuple)): - return objects.order_by(*self.order_by) - else: - return objects.order_by(self.order_by) + return objects.order_by(*self._get_order_by()) class PaginatorContext(object): visible_page_range = 5