summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
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
commit4da02abdd3d489c412df9511f5c21a3a7f6b629a (patch)
tree815f83f6282b1ecb648c7be7e6607d229d17b838 /ishtar_common/views.py
parent286944a0ad4682c1a2377ec4d010538233674ff6 (diff)
downloadIshtar-4da02abdd3d489c412df9511f5c21a3a7f6b629a.tar.bz2
Ishtar-4da02abdd3d489c412df9511f5c21a3a7f6b629a.zip
Fix table sort on multiple keys for a column
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py15
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