diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-18 11:48:53 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-18 11:48:53 +0100 |
commit | b2a8dbbc4710ea4a1ad94e6bbc7d73b025e3fd19 (patch) | |
tree | 815f83f6282b1ecb648c7be7e6607d229d17b838 /ishtar_common/views.py | |
parent | f6fe204ef36dfbafae1603055824266f6ff82ea8 (diff) | |
download | Ishtar-b2a8dbbc4710ea4a1ad94e6bbc7d73b025e3fd19.tar.bz2 Ishtar-b2a8dbbc4710ea4a1ad94e6bbc7d73b025e3fd19.zip |
Fix table sort on multiple keys for a column
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r-- | ishtar_common/views.py | 15 |
1 files changed, 9 insertions, 6 deletions
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 |