forked from CGM_Public/pretix_original
Improve email history template
This commit is contained in:
@@ -16,31 +16,17 @@
|
|||||||
{% if log.display %}
|
{% if log.display %}
|
||||||
<br/><span class="fa fa-comment-o"></span> {{ log.display }}
|
<br/><span class="fa fa-comment-o"></span> {{ log.display }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
<br/><span class="fa fa-shopping-cart"></span> {% trans "Sent to orders:" %}
|
||||||
<p>
|
{% for status in log.parsed_data.sendto %}
|
||||||
<strong>Email address:</strong> {{ log.parsed_data.recipients }}
|
{{ status }}{% if forloop.revcounter > 1 %},{% endif %}
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<strong>Subject:</strong>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{% for key,value in log.parsed_data.subject.items %}
|
|
||||||
<p>
|
|
||||||
{{ key }}: {{ value }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Email content:</strong>
|
{% for locale, value in log.pdata.locales.items %}
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{% for key,value in log.parsed_data.message.items %}
|
|
||||||
<p>
|
<p>
|
||||||
{{ key }}:
|
<strong>[{{ locale }}] {% trans "Subject:" %} {{ value.subject }}</strong>
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{{ value|linebreaksbr }}
|
|
||||||
</p>
|
</p>
|
||||||
|
<pre>{{ value.message|linebreaksbr }}</pre>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ class SenderView(EventPermissionRequiredMixin, FormView):
|
|||||||
user=self.request.user,
|
user=self.request.user,
|
||||||
data={
|
data={
|
||||||
'subject': form.cleaned_data['subject'],
|
'subject': form.cleaned_data['subject'],
|
||||||
'content': form.cleaned_data['message'],
|
'message': form.cleaned_data['message'],
|
||||||
'recipients': o.email
|
'recipient': o.email
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except SendMailException:
|
except SendMailException:
|
||||||
@@ -110,7 +110,7 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
|
|||||||
permission = 'can_change_orders'
|
permission = 'can_change_orders'
|
||||||
model = LogEntry
|
model = LogEntry
|
||||||
context_object_name = 'logs'
|
context_object_name = 'logs'
|
||||||
paginate_by = 15
|
paginate_by = 5
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = LogEntry.objects.filter(
|
qs = LogEntry.objects.filter(
|
||||||
@@ -118,3 +118,21 @@ class EmailHistoryView(EventPermissionRequiredMixin, ListView):
|
|||||||
action_type='pretix.plugins.sendmail.sent'
|
action_type='pretix.plugins.sendmail.sent'
|
||||||
)
|
)
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
ctx = super().get_context_data()
|
||||||
|
|
||||||
|
status = dict(Order.STATUS_CHOICE)
|
||||||
|
for log in ctx['logs']:
|
||||||
|
log.pdata = log.parsed_data
|
||||||
|
log.pdata['locales'] = {}
|
||||||
|
for locale, msg in log.pdata['message'].items():
|
||||||
|
log.pdata['locales'][locale] = {
|
||||||
|
'message': msg,
|
||||||
|
'subject': log.pdata['subject'][locale]
|
||||||
|
}
|
||||||
|
log.pdata['sendto'] = [
|
||||||
|
status[s] for s in log.pdata['sendto']
|
||||||
|
]
|
||||||
|
|
||||||
|
return ctx
|
||||||
|
|||||||
Reference in New Issue
Block a user