summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-09-09 17:33:12 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:58 +0100
commit9992bf5614ed22b99f0b341b3d4252c8f0c88e06 (patch)
tree93df91b512ec977fb4edbace3606624e73a0c2f0
parent12f02e8dbf3350dfb2de509a0ad2911a4edcb344 (diff)
downloadIshtar-9992bf5614ed22b99f0b341b3d4252c8f0c88e06.tar.bz2
Ishtar-9992bf5614ed22b99f0b341b3d4252c8f0c88e06.zip
Migration to Django 2.2 - fixes
- fix historized object display
-rw-r--r--ishtar_common/templatetags/window_field.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py
index 0e6b4e0d6..47256aea2 100644
--- a/ishtar_common/templatetags/window_field.py
+++ b/ishtar_common/templatetags/window_field.py
@@ -98,14 +98,15 @@ def field_multiple(caption, data, li=False, size=None):
@register.simple_tag
def field_multiple_obj(caption, item, attr, li=False, size=None):
- data = getattr(item, attr)
+ data = getattr(item, attr) if hasattr(item, attr) else ""
if not hasattr(item, '_step') or attr not in item.history_m2m \
or not item.history_m2m[attr]:
t = loader.get_template('ishtar/blocks/window_field_flex_multiple.html')
return t.render(
{'caption': caption, 'data': data, 'li': li, "size": size}
)
- rel_model = data.model
+ field = getattr(item.instance.__class__, attr)
+ rel_model = field.rel.model
data = rel_model.history_decompress(item.history_m2m[attr])
t = loader.get_template(
'ishtar/blocks/window_field_flex_historized_multiple.html')