From bb7f17f52688f5d4c191c098a19c944a7be17cda Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Jun 2025 11:38:00 +0200 Subject: 🐛 regenerate QRCode when file is missing - better scale for QRCode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example_project/settings.py | 2 +- ishtar_common/models_common.py | 3 ++- 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 -- cgit v1.2.3