show number of held emails in backoffice menu

This commit is contained in:
Thomas Steen Rasmussen 2021-06-27 15:26:05 +02:00
parent 71e393cfe6
commit 226bbca220
2 changed files with 6 additions and 1 deletions

View file

@ -141,7 +141,11 @@
</a> </a>
<a href="{% url 'backoffice:outgoing_email_release' camp_slug=camp.slug %}" class="list-group-item"> <a href="{% url 'backoffice:outgoing_email_release' camp_slug=camp.slug %}" class="list-group-item">
<h4 class="list-group-item-heading">Edit and Release Held Emails</h4> <h4 class="list-group-item-heading">Edit and Release Held Emails</h4>
<p class="list-group-item-text">Use this view to edit and release OutgoingEmailQueue objects on hold.</p> {% if held_email_count %}
<p class="list-group-item-text">Use this view to edit and release <span class="label label-warning">{{ held_email_count }}</span> OutgoingEmailQueue objects on hold.</p>
{% else %}
<p class="list-group-item-text">No emails are currently held for release. Check back later!</p>
{% endif %}
</a> </a>
{% endif %} {% endif %}

View file

@ -98,6 +98,7 @@ class BackofficeIndexView(CampViewMixin, RaisePermissionRequiredMixin, TemplateV
) )
) )
) )
context["held_email_count"] = OutgoingEmail.objects.filter(hold=True, responsible_team__isnull=True).count() + OutgoingEmail.objects.filter(hold=True, responsible_team__camp=self.camp).count()
return context return context