diff options
author | Alban Gruin | 2017-02-13 19:43:51 +0100 |
---|---|---|
committer | Alban Gruin | 2017-02-13 19:43:51 +0100 |
commit | 9291be977860d911ef5c16eb6ea4ed512f1f10dc (patch) | |
tree | 676931e45612e002abb282a7d681dd1bed760724 /management/commands/sendmails.py | |
parent | 6293e36aec2e1a1b99853925e68e578a7d6ae516 (diff) | |
parent | b687e245d351e09cdec0ffb548543ced717000e6 (diff) |
Merge branch 'stable/0.6.z' into prod/pa1ch/0.6.zv0.6.2-pa1ch
Diffstat (limited to 'management/commands/sendmails.py')
-rw-r--r-- | management/commands/sendmails.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/management/commands/sendmails.py b/management/commands/sendmails.py index e30bb1b..9a05a9c 100644 --- a/management/commands/sendmails.py +++ b/management/commands/sendmails.py @@ -40,7 +40,6 @@ class Command(BaseCommand): mails = [] footer = loader.get_template("mail/mail_footer.txt") - no_event = loader.get_template("mail/mail_noevent.txt") timetable = loader.get_template("mail/mail_timetable.txt") print("Generating messages...") @@ -48,13 +47,9 @@ class Command(BaseCommand): if subscription.group.id not in content: courses = Course.objects.get_courses_for_group(subscription.group, begin__gte=start, begin__lt=end) - if len(courses) > 0: - grouped_courses = group_courses(courses) - context = Context({"courses": grouped_courses, "week": week}) - content[subscription.group.id] = timetable.render(context) - else: - context = Context({"group": subscription.group, "week": week}) - content[subscription.group.id] = no_event.render(context) + grouped_courses = group_courses(courses) + context = Context({"courses": grouped_courses, "group": subscription.group, "week": week}) + content[subscription.group.id] = timetable.render(context) context = Context({"admins": settings.ADMINS, "token": subscription.token, "domain": settings.DEFAULT_DOMAIN}) mail_content = content[subscription.group.id] + footer.render(context) |