From 464f95ee40874190fca1bf052427835303a9ce74 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 7 Jan 2024 17:03:49 +1100 Subject: [PATCH] fix empty emails --- blogs/management/commands/send_weekly_email.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blogs/management/commands/send_weekly_email.py b/blogs/management/commands/send_weekly_email.py index 7fb5cc8..4f54ee9 100644 --- a/blogs/management/commands/send_weekly_email.py +++ b/blogs/management/commands/send_weekly_email.py @@ -200,6 +200,8 @@ class Command(BaseCommand): coming_events, ] body = "".join(sections) + if body == "": + body = "

No new updates this week.

Why not spend the time you would have been reading, publishing your own blog post instead?

" for subscriber in subscribers: opt_out = f"https://{settings.DOMAIN}/unsubscribe-email/{subscriber.token}/{subscriber.id}"