summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/models.py1
-rw-r--r--ishtar_common/views_item.py13
2 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 6d644cb63..b011e541f 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -4240,6 +4240,7 @@ class Document(
]
SERIALIZATION_FILES = ["image", "thumbnail", "associated_file"]
SERIALIZE_PROPERTIES = ["external_id", "images_number"]
+ SELECT_GROUP_BY = True # v4.0 patch
title = models.TextField(_("Title"), blank=True, default="")
associated_file = models.FileField(
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index d80de34c7..c6110d930 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -2559,6 +2559,19 @@ def get_item(
elif "name" in res:
res["value"] = res.pop("name")
rows.append(res)
+ # v4.0 patch
+ if getattr(model, "SELECT_GROUP_BY", False):
+ new_rows = OrderedDict()
+ for row in rows:
+ idx = row["id"]
+ if idx in new_rows:
+ for key in row:
+ if row[key] == new_rows[idx][key]:
+ continue
+ new_rows[idx][key] += " ; " + row[key]
+ else:
+ new_rows[idx] = row
+ rows = [row for __, row in new_rows.items()]
if full == "shortcut":
data = json.dumps(rows)
else: