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
@@ -16,10 +16,13 @@
{% if log.display %} {% if log.display %}
<br/><span class="fa fa-comment-o fa-fw"></span> {{ log.display }} <br/><span class="fa fa-comment-o fa-fw"></span> {{ log.display }}
{% endif %} {% 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 %} {% for status in log.parsed_data.sendto %}
{{ status }}{% if forloop.revcounter > 1 %},{% endif %} {{ status }}{% if forloop.revcounter > 1 %},{% endif %}
{% endfor %} {% 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 %} {% if log.pdata.subevent_obj %}
<br/><span class="fa fa-calendar fa-fw"></span> {{ log.pdata.subevent_obj }} <br/><span class="fa fa-calendar fa-fw"></span> {{ log.pdata.subevent_obj }}
{% endif %} {% endif %}
+7 -1
View File
@@ -145,12 +145,15 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
qs = LogEntry.objects.filter( qs = LogEntry.objects.filter(
event=self.request.event, event=self.request.event,
action_type='pretix.plugins.sendmail.sent' action_type='pretix.plugins.sendmail.sent'
) ).select_related('event', 'user')
return qs return qs
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
ctx = super().get_context_data() ctx = super().get_context_data()
itemcache = {
i.pk: str(i) for i in self.request.event.items.all()
}
status = dict(Order.STATUS_CHOICE) status = dict(Order.STATUS_CHOICE)
status['overdue'] = _('pending with payment overdue') status['overdue'] = _('pending with payment overdue')
status['r'] = status['c'] status['r'] = status['c']
@@ -165,6 +168,9 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
log.pdata['sendto'] = [ log.pdata['sendto'] = [
status[s] for s in 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'): if log.pdata.get('subevent'):
try: try:
log.pdata['subevent_obj'] = self.request.event.subevents.get(pk=log.pdata['subevent']['id']) log.pdata['subevent_obj'] = self.request.event.subevents.get(pk=log.pdata['subevent']['id'])