diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-02-14 15:56:05 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-02-14 17:38:09 +0100 |
commit | e7c1f8b74f92778f16721a6ad358f4f248f2a9f6 (patch) | |
tree | 58d2d98b4ed38e5204ae54409357eee8ec576fd0 /ishtar_common/models.py | |
parent | aef3dfa74b0e2a0a7563d4798ebcf6b0f9998b02 (diff) | |
download | Ishtar-e7c1f8b74f92778f16721a6ad358f4f248f2a9f6.tar.bz2 Ishtar-e7c1f8b74f92778f16721a6ad358f4f248f2a9f6.zip |
🐛 fix VALUES serialization for preventive archaeological files
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 688197c73..abff81056 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -93,6 +93,7 @@ from ishtar_common.utils import ( task, generate_pdf_preview, revoke_old_task, + InlineClass ) from ishtar_common.utils_secretary import IshtarSecretaryRenderer @@ -138,6 +139,7 @@ from ishtar_common.utils import ( cached_label_changed, generate_relation_graph, max_size_help, + JSON_SERIALIZATION ) from ishtar_common.models_common import ( @@ -2324,6 +2326,12 @@ class DocumentTemplate(models.Model): filtr = [] values = c_object.get_values(filtr=filtr) if not filtr or "VALUES" in filtr: + for k in values: + if k in JSON_SERIALIZATION: + values[k] = JSON_SERIALIZATION[k](values[k]) + elif values[k] and isinstance(values[k], list) \ + and hasattr(values[k][0], "toJSON"): + values[k] = [v.toJSON() for v in values[k]] values["VALUES"] = json.dumps( values, indent=4, |