Commit 3f42fc25 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'fix/agenda-order-newsletter' into 'master'

Order newsletter agenda items by date

Closes #221

See merge request !233
parents 323b00f3 08c50edb
......@@ -58,7 +58,7 @@ class Command(BaseCommand):
newsletter.save()
start = 6 if "AGENDA" in all_tr[3].text else 5
start = 5 if "AGENDA" in all_tr[3].text else 4
items = all_tr[start:len(all_tr)]
......
......@@ -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 }}:
......
......@@ -76,18 +76,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