Sendmail history: Show selected items

This commit is contained in:
Raphael Michel
2019-03-08 12:18:13 +01:00
parent 206a0a28c7
commit e53818b025
2 changed files with 11 additions and 2 deletions

View File

@@ -16,10 +16,13 @@
{% if log.display %}
<br/><span class="fa fa-comment-o fa-fw"></span> {{ log.display }}
{% endif %}
<br/><span class="fa fa-shopping-cart fa-fw"></span> {% trans "Sent to orders:" %}
<br/><span class="fa fa-tag fa-fw"></span> {% trans "Sent to orders:" %}
{% for status in log.parsed_data.sendto %}
{{ status }}{% if forloop.revcounter > 1 %},{% endif %}
{% endfor %}
{% if log.pdata.items %}
<br/><span class="fa fa-shopping-cart fa-fw"></span> {{ log.pdata.items|join:", " }}
{% endif %}
{% if log.pdata.subevent_obj %}
<br/><span class="fa fa-calendar fa-fw"></span> {{ log.pdata.subevent_obj }}
{% endif %}

View File

@@ -145,12 +145,15 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
qs = LogEntry.objects.filter(
event=self.request.event,
action_type='pretix.plugins.sendmail.sent'
)
).select_related('event', 'user')
return qs
def get_context_data(self, **kwargs):
ctx = super().get_context_data()
itemcache = {
i.pk: str(i) for i in self.request.event.items.all()
}
status = dict(Order.STATUS_CHOICE)
status['overdue'] = _('pending with payment overdue')
status['r'] = status['c']
@@ -165,6 +168,9 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
log.pdata['sendto'] = [
status[s] for s in log.pdata['sendto']
]
log.pdata['items'] = [
itemcache[i['id']] for i in log.pdata.get('items', [])
]
if log.pdata.get('subevent'):
try:
log.pdata['subevent_obj'] = self.request.event.subevents.get(pk=log.pdata['subevent']['id'])