From 4e4afe181b3e8c08d88854cba05f47693c576792 Mon Sep 17 00:00:00 2001 From: Simon Yuill Date: Thu, 21 Aug 2025 13:54:08 +0100 Subject: [PATCH 1/5] rev.publish() command commented out --- wagtail_qrcode/wagtail_hooks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index 992b629..a1b9a12 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -25,8 +25,8 @@ def generate_qr_code(request, page): rev = page.save_revision() - if page.live: - rev.publish() + # if page.live: + # rev.publish() def send_qr_code_email(page, email=None, subject=None, body=None): From c60cad2d4a84b9f6efb1c57ec9270084b653e372 Mon Sep 17 00:00:00 2001 From: Simon Yuill Date: Thu, 21 Aug 2025 14:02:28 +0100 Subject: [PATCH 2/5] testing --- wagtail_qrcode/wagtail_hooks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index a1b9a12..37f023e 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -25,6 +25,8 @@ def generate_qr_code(request, page): rev = page.save_revision() + print("generate_qr_code") + # if page.live: # rev.publish() From 8be5e2f8c6ce8fe41271eb4edd7280e1fc65f5be Mon Sep 17 00:00:00 2001 From: Simon Yuill Date: Thu, 21 Aug 2025 14:26:13 +0100 Subject: [PATCH 3/5] rev.publish() removed from generate_qr_code --- wagtail_qrcode/wagtail_hooks.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index 37f023e..09a6a3a 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -25,11 +25,6 @@ def generate_qr_code(request, page): rev = page.save_revision() - print("generate_qr_code") - - # if page.live: - # rev.publish() - def send_qr_code_email(page, email=None, subject=None, body=None): """Send the QR code to the email address.""" From 968271289869784fbd8cf7848271ef1ccc8d1840 Mon Sep 17 00:00:00 2001 From: Simon Yuill Date: Thu, 21 Aug 2025 20:36:01 +0100 Subject: [PATCH 4/5] allow WAGTAIL_QR_CODE_AUTO_PUBLISH_UPDATES setting on generate_qr_code --- wagtail_qrcode/wagtail_hooks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index 09a6a3a..1264790 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -25,6 +25,12 @@ def generate_qr_code(request, page): rev = page.save_revision() + if ( + page.live + and getattr(settings, "WAGTAIL_QR_CODE_AUTO_PUBLISH_UPDATES", False) == True + ): + rev.publish() + def send_qr_code_email(page, email=None, subject=None, body=None): """Send the QR code to the email address.""" From 1c0ddb2b52cdf90b20693b2a1adc2115772b8e54 Mon Sep 17 00:00:00 2001 From: Simon Yuill Date: Thu, 21 Aug 2025 21:11:56 +0100 Subject: [PATCH 5/5] #61 handling of conditional updated to match coding preferences --- wagtail_qrcode/wagtail_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index 1264790..36cbe6a 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -27,7 +27,7 @@ def generate_qr_code(request, page): if ( page.live - and getattr(settings, "WAGTAIL_QR_CODE_AUTO_PUBLISH_UPDATES", False) == True + and getattr(settings, "WAGTAIL_QR_CODE_AUTO_PUBLISH_UPDATES", False) is True ): rev.publish()