Commit 08c50edb authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Order agenda newsletter by date

parent 3f8db006
......@@ -71,7 +71,7 @@
<table style="width: 100%">
<tbody>
<td>
{% for row in newsletter.newsletterevent_set.all|rows_distributed:2 %}
{% for row in agenda_events|rows_distributed:2 %}
<td style="vertical-align: top;">
{% for item in row %}
<li style="font-family: Arial, sans-serif;"><i>{{ item.title }} - {{ item.start_datetime|date:"d F" }}</i></li>
......
......@@ -6,7 +6,7 @@
{% trans "agenda"|upper %}:
{% for item in newsletter.newsletterevent_set.all %} {{ item.title }} - {{ item.start_datetime|date:"d F" }}
{% for item in agenda_events %} {{ item.title }} - {{ item.start_datetime|date:"d F" }}
{% endfor %}
{% for item in newsletter.newsletteritem_set.all %}{{ item.title|upper }}:
......
......@@ -21,6 +21,8 @@ def preview(request, pk):
return render(request, 'newsletters/email.html', {
'newsletter': newsletter,
'agenda_events': newsletter.newsletterevent_set.all().order_by(
'start_datetime'),
'main_partner': main_partner,
'lang_code': request.LANGUAGE_CODE
})
......@@ -62,18 +64,18 @@ def admin_send(request, pk):
if member.is_active() is True]
subject = newsletter.title
html_message = html_template.render(Context({
'newsletter': newsletter,
'main_partner': main_partner,
'lang_code': language,
'request': request
}))
text_message = text_template.render(Context({
context = Context({
'newsletter': newsletter,
'agenda_events': newsletter.newsletterevent_set.all().order_by(
'start_datetime'),
'main_partner': main_partner,
'lang_code': language,
'request': request
}))
})
html_message = html_template.render(context)
text_message = text_template.render(context)
msg = EmailMultiAlternatives(subject, text_message,
to=[from_email],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment