diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-13 11:38:00 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-13 12:25:01 +0200 |
commit | bb7f17f52688f5d4c191c098a19c944a7be17cda (patch) | |
tree | 5132bc3bb98e566c68ae78b81a769773a3c14f47 | |
parent | 0b741c2ffd68a5334894466023222a99b30118ca (diff) | |
download | Ishtar-bb7f17f52688f5d4c191c098a19c944a7be17cda.tar.bz2 Ishtar-bb7f17f52688f5d4c191c098a19c944a7be17cda.zip |
🐛 regenerate QRCode when file is missing - better scale for QRCode
-rw-r--r-- | example_project/settings.py | 2 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 3 | ||||
-rw-r--r-- | ishtar_common/views.py | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/example_project/settings.py b/example_project/settings.py index ae1a8f642..06a40981d 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -273,7 +273,7 @@ LIBREOFFICE_HOST = "localhost" ISHTAR_FEED_URL = "https://discourse.ishtar-archeo.net/latest.rss" ISHTAR_MAP_MAX_ITEMS = 50000 ISHTAR_QRCODE_VERSION = 6 # density of the QR code -ISHTAR_QRCODE_SCALE = 2 # scale of the QR code +ISHTAR_QRCODE_SCALE = 5 # scale of the QR code ISHTAR_DEFAULT_YEAR = 1900 ISHTAR_MUSEUM_GAM = False # France - AlimGAM export of exhibitions # exclude business days from deadline calculation diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 01874bf56..13447a4d3 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -4852,7 +4852,8 @@ class CompleteIdentifierItem(models.Model, ImageContainerModel): @property def qrcode_path(self): - if not self.qrcode: + if not self.qrcode or ( + self.qrcode.path and not os.path.exists(self.qrcode.path)): self.generate_qrcode() if not self.qrcode: # error on qrcode generation return "" diff --git a/ishtar_common/views.py b/ishtar_common/views.py index af2cf3a98..4510177f9 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1548,7 +1548,8 @@ class QRCodeView(DynamicModelView, IshtarMixin, LoginRequiredMixin, View): if not hasattr(item, "qrcode"): raise Http404() - if not item.qrcode or not item.qrcode.name: + if not item.qrcode or not item.qrcode.name or not os.path.exists( + item.qrcode.path): item.generate_qrcode(request=self.request) if not item.qrcode or not item.qrcode.name: # generation has failed |