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 11:43:46 +0200 |
commit | cee233fb87e42afc8b5ffc241d1fcd4f12139bc4 (patch) | |
tree | 66f020df4b604dd25487fe20034eb6617a5a84d4 | |
parent | 81b0a864d0846e64287e6f5b43cf0695b070da81 (diff) | |
download | Ishtar-cee233fb87e42afc8b5ffc241d1fcd4f12139bc4.tar.bz2 Ishtar-cee233fb87e42afc8b5ffc241d1fcd4f12139bc4.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 726ccda8e..66b429bab 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -270,7 +270,7 @@ LIBREOFFICE_HOST = "localhost" 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_SLUGS = { diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 9f5be1e36..c623a0604 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -4453,7 +4453,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 a2e6658dd..29e7e5fe5 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1496,7 +1496,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 |