From b2a8dbbc4710ea4a1ad94e6bbc7d73b025e3fd19 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 18 Jan 2018 11:48:53 +0100 Subject: Fix table sort on multiple keys for a column --- ishtar_common/views.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index cc2443f80..2b6dead9b 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -992,12 +992,15 @@ def get_item(model, func_name, default_name, extra_request_keys=[], signe, col_num = sorts[idx] k = query_table_cols[int(col_num) - 2] # remove id and link col if k in request_keys: - k = request_keys[k] - if k.endswith("__pk"): - k = k[:-len("__pk")] + "__label" - if '__' in k: - k = k.split('__')[0] - orders.append(signe + k) + ks = request_keys[k] + if type(ks) not in (tuple, list): + ks = [ks] + for k in ks: + if k.endswith("__pk"): + k = k[:-len("__pk")] + "__label" + if '__' in k: + k = k.split('__')[0] + orders.append(signe + k) else: # not a standard request key if idx: # not the first - we ignore this sort -- cgit v1.2.3