Cleanup in report-body-html.html.

Add a "Send Nag" admin command for easier testing.
This commit is contained in:
Pēteris Caune 2019-09-03 09:24:56 +03:00
parent 339ac5e9d9
commit 93507fcc47
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 19 additions and 16 deletions

View File

@ -189,7 +189,7 @@ class ProjectAdmin(admin.ModelAdmin):
class HcUserAdmin(UserAdmin): class HcUserAdmin(UserAdmin):
actions = ["send_report"] actions = ["send_report", "send_nag"]
list_display = ( list_display = (
"id", "id",
"email", "email",
@ -237,6 +237,12 @@ class HcUserAdmin(UserAdmin):
self.message_user(request, "%d email(s) sent" % qs.count()) 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.unregister(User)
admin.site.register(User, HcUserAdmin) admin.site.register(User, HcUserAdmin)

View File

@ -15,35 +15,32 @@ Hello,<br />
{% else %} {% else %}
{{ num_down }} checks are currently <strong>DOWN</strong>. {{ num_down }} checks are currently <strong>DOWN</strong>.
{% endif %} {% endif %}
{% else %}
This is a monthly report sent by <a href="{% site_root %}">{% site_name %}</a>.
{% endif %}
<br /> <br />
{% if nag %}
{% include "emails/summary-html.html" %} {% include "emails/summary-html.html" %}
{% else %}
{% include "emails/summary-downtimes-html.html" %}
{% endif %}
{% if nag %}
<strong>Too many notifications?</strong> <strong>Too many notifications?</strong>
Visit the <a href="{{ notifications_url }}">Email Reports</a> Visit the <a href="{{ notifications_url }}">Email Reports</a>
page on {% site_name %} to set your notification preferences. page on {% site_name %} to set your notification preferences.
{% else %} {% else %}
This is a monthly report sent by <a href="{% site_root %}">{% site_name %}</a>.
<br />
{% include "emails/summary-downtimes-html.html" %}
<strong>Just one more thing to check:</strong> <strong>Just one more thing to check:</strong>
Do you have more cron jobs, Do you have more cron jobs,
not yet on this list, that would benefit from monitoring? not yet on this list, that would benefit from monitoring?
Get the ball rolling by adding one more! Get the ball rolling by adding one more!
{% endif %} {% endif %}
<br /><br /> <br /><br />
Cheers,<br> Cheers,<br>
The {% site_name %} Team The {% site_name %} Team
{% endblock %} {% endblock %}
{% block unsub %} {% block unsub %}
<br> <br>
<a href="{{ unsub_link }}?ask=1" target="_blank" style="color: #666666; text-decoration: underline;"> <a href="{{ unsub_link }}?ask=1" target="_blank" style="color: #666666; text-decoration: underline;">