diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-04-12 17:53:27 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-04-12 17:56:28 +0200 |
commit | 226bc1e62a3fec5df009d3f4bc349303167b289f (patch) | |
tree | 1847020756d69ea7d75b9a5d2cbd78e9d72fca7d /ishtar_common/views_item.py | |
parent | d489063468c6cf5ec8602d37e76d063ec238a42f (diff) | |
download | Ishtar-226bc1e62a3fec5df009d3f4bc349303167b289f.tar.bz2 Ishtar-226bc1e62a3fec5df009d3f4bc349303167b289f.zip |
CSV export: manage __count - fix get localisations
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r-- | ishtar_common/views_item.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 9c20f7e2c..3787e7d19 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -1369,10 +1369,14 @@ def _get_data_from_query_old( splitted_k += ky.split("__") else: splitted_k.append(ky) + if splitted_k[-1] == "count": + splitted_k = splitted_k[:-2] + [splitted_k[-2] + "__count"] for ky in splitted_k: new_vals = [] for val in vals: - if hasattr(val, "all"): # manage related objects + if ky.endswith("__count"): + new_vals += [getattr(val, ky[:-len("__count")]).count()] + elif hasattr(val, "all"): # manage related objects val = list(val.all()) for v in val: v = getattr(v, ky) |