From 34e8730496ff9eef0b65c1e7f64476700181fba6 Mon Sep 17 00:00:00 2001 From: tobes Date: Tue, 7 Aug 2012 17:46:24 +0100 Subject: [PATCH] [#2722] fix group dataset sort --- ckan/controllers/group.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckan/controllers/group.py b/ckan/controllers/group.py index 1b7557e681b..2b2038c2288 100644 --- a/ckan/controllers/group.py +++ b/ckan/controllers/group.py @@ -139,6 +139,7 @@ def read(self, id): # most search operations should reset the page counter: params_nopage = [(k, v) for k, v in request.params.items() if k != 'page'] + sort_by = request.params.get('sort', 'name asc') def search_url(params): url = h.url_for(controller='group', action='read', @@ -170,7 +171,7 @@ def pager_url(q=None, page=None): c.fields = [] search_extras = {} for (param, value) in request.params.items(): - if not param in ['q', 'page'] \ + if not param in ['q', 'page', 'sort'] \ and len(value) and not param.startswith('_'): if not param.startswith('ext_'): c.fields.append((param, value)) @@ -188,6 +189,7 @@ def pager_url(q=None, page=None): 'fq': fq, 'facet.field': g.facets, 'rows': limit, + 'sort': sort_by, 'start': (page - 1) * limit, 'extras': search_extras }