From 93507fcc477c4df8784163d03fa7ff57897a2744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Tue, 3 Sep 2019 09:24:56 +0300 Subject: [PATCH] Cleanup in report-body-html.html. Add a "Send Nag" admin command for easier testing. --- hc/accounts/admin.py | 8 +++++++- templates/emails/report-body-html.html | 27 ++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/hc/accounts/admin.py b/hc/accounts/admin.py index a7422583..36042780 100644 --- a/hc/accounts/admin.py +++ b/hc/accounts/admin.py @@ -189,7 +189,7 @@ class ProjectAdmin(admin.ModelAdmin): class HcUserAdmin(UserAdmin): - actions = ["send_report"] + actions = ["send_report", "send_nag"] list_display = ( "id", "email", @@ -237,6 +237,12 @@ class HcUserAdmin(UserAdmin): self.message_user(request, "%d email(s) sent" % qs.count()) + def send_nag(self, request, qs): + for user in qs: + user.profile.send_report(nag=True) + + self.message_user(request, "%d email(s) sent" % qs.count()) + admin.site.unregister(User) admin.site.register(User, HcUserAdmin) diff --git a/templates/emails/report-body-html.html b/templates/emails/report-body-html.html index d61bbf75..4ff0a6ce 100644 --- a/templates/emails/report-body-html.html +++ b/templates/emails/report-body-html.html @@ -15,35 +15,32 @@ Hello,
{% else %} {{ num_down }} checks are currently DOWN. {% endif %} -{% else %} - This is a monthly report sent by {% site_name %}. -{% endif %} -
- -{% if nag %} +
{% include "emails/summary-html.html" %} -{% else %} - {% include "emails/summary-downtimes-html.html" %} -{% endif %} -{% if nag %} Too many notifications? Visit the Email Reports page on {% site_name %} to set your notification preferences. + {% else %} -Just one more thing to check: -Do you have more cron jobs, -not yet on this list, that would benefit from monitoring? -Get the ball rolling by adding one more! + This is a monthly report sent by {% site_name %}. + +
+ {% include "emails/summary-downtimes-html.html" %} + + Just one more thing to check: + Do you have more cron jobs, + not yet on this list, that would benefit from monitoring? + Get the ball rolling by adding one more! {% endif %} +

Cheers,
The {% site_name %} Team {% endblock %} - {% block unsub %}