summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-11-04 16:00:20 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2020-11-04 16:00:20 +0100
commit72b0e6ca45a7296f6288bf994ff3da86c85bad32 (patch)
treee2b9ea825e5ef20a81bef7d58688cd4fe798eeca
parenta8400088480d5389345c0aa5ff691704f9764513 (diff)
downloadIshtar-72b0e6ca45a7296f6288bf994ff3da86c85bad32.tar.bz2
Ishtar-72b0e6ca45a7296f6288bf994ff3da86c85bad32.zip
Labels generation: fix missing images in templates
-rw-r--r--archaeological_operations/tests.py5
-rw-r--r--ishtar_common/models.py2
-rw-r--r--ishtar_common/templates/blocks/DataTables-content.html2
-rw-r--r--ishtar_common/utils_secretary.py2
4 files changed, 7 insertions, 4 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 9cb715a6f..bb8c02c78 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -2449,7 +2449,10 @@ class LabelTest(TestCase, OperationInitTest):
z = zipfile.ZipFile(f)
self.assertIsNone(z.testzip())
content = z.open('content.xml')
- self.assertIn(b'1789', content.read())
+ full_content = content.read()
+ self.assertIn(b'1789', full_content)
+ # jpe file are added for missing pictures / must be filtered
+ self.assertNotIn(b'.jpe"', full_content)
finally:
if content:
content.close()
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 0e68bf7dd..94d8744e5 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -3665,7 +3665,7 @@ class DocumentTemplate(models.Model):
break
obj = objects[c_idx]
values["items"].append(obj.get_values())
- engine = SecretaryRenderer()
+ engine = IshtarSecretaryRenderer()
try:
result = engine.render(self.template, **values)
except TemplateSyntaxError as e:
diff --git a/ishtar_common/templates/blocks/DataTables-content.html b/ishtar_common/templates/blocks/DataTables-content.html
index 82da411e1..814e10c18 100644
--- a/ishtar_common/templates/blocks/DataTables-content.html
+++ b/ishtar_common/templates/blocks/DataTables-content.html
@@ -44,7 +44,7 @@
<button id="export-labels-{{name}}" type="button"
class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
- {% trans 'Labels'%}
+ {% trans 'Labels' context 'To be print' %}
</button>
<div class="dropdown-menu" aria-labelledby="export-labels-{{name}}">
{% for template in current_model.label_templates %}
diff --git a/ishtar_common/utils_secretary.py b/ishtar_common/utils_secretary.py
index 972b7d223..f1266b856 100644
--- a/ishtar_common/utils_secretary.py
+++ b/ishtar_common/utils_secretary.py
@@ -49,7 +49,7 @@ class IshtarSecretaryRenderer(Renderer):
def ishtar_media_loader(self, media, *args, **kwargs):
res = self.fs_loader(media, *args, **kwargs)
- if not res:
+ if not res or not res[0]:
return
image_file, mime = res
if "width" in kwargs: