From 787e825f2e24ce004d79e74e72f509aded72b1a0 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Thu, 17 May 2018 20:41:56 -0400 Subject: [PATCH] Refactor email templates into separate directories --- .../management/commands/create_next_in_series.py | 4 ++-- .../commands/send_daily_attendee_update.py | 4 ++-- .../management/commands/send_daily_member_update.py | 4 ++-- .../commands/send_email_confirmation_reminder.py | 4 ++-- .../management/commands/send_event_reminder.py | 4 ++-- .../emails/{ => events}/attendee_contact.html | 0 .../emails/{ => events}/attendee_contact.txt | 0 .../emails/{ => events}/attendee_invite.html | 0 .../emails/{ => events}/attendee_invite.txt | 0 .../emails/{ => events}/event_comment.html | 0 .../emails/{ => events}/event_comment.txt | 0 .../emails/{ => events}/event_from_series.html | 0 .../emails/{ => events}/event_from_series.txt | 0 .../emails/{ => events}/new_event_attendees.html | 0 .../emails/{ => events}/new_event_attendees.txt | 0 .../get_together/emails/{ => events}/reminder.html | 0 .../get_together/emails/{ => events}/reminder.txt | 0 .../emails/{ => teams}/member_contact.html | 0 .../emails/{ => teams}/member_contact.txt | 0 .../emails/{ => teams}/member_invite.html | 0 .../emails/{ => teams}/member_invite.txt | 0 .../emails/{ => teams}/new_team_members.html | 0 .../emails/{ => teams}/new_team_members.txt | 0 .../emails/{ => users}/confirm_email.html | 0 .../emails/{ => users}/confirm_email.txt | 0 get_together/views/events.py | 12 ++++++------ get_together/views/new_user.py | 4 ++-- get_together/views/teams.py | 8 ++++---- 28 files changed, 22 insertions(+), 22 deletions(-) rename get_together/templates/get_together/emails/{ => events}/attendee_contact.html (100%) rename get_together/templates/get_together/emails/{ => events}/attendee_contact.txt (100%) rename get_together/templates/get_together/emails/{ => events}/attendee_invite.html (100%) rename get_together/templates/get_together/emails/{ => events}/attendee_invite.txt (100%) rename get_together/templates/get_together/emails/{ => events}/event_comment.html (100%) rename get_together/templates/get_together/emails/{ => events}/event_comment.txt (100%) rename get_together/templates/get_together/emails/{ => events}/event_from_series.html (100%) rename get_together/templates/get_together/emails/{ => events}/event_from_series.txt (100%) rename get_together/templates/get_together/emails/{ => events}/new_event_attendees.html (100%) rename get_together/templates/get_together/emails/{ => events}/new_event_attendees.txt (100%) rename get_together/templates/get_together/emails/{ => events}/reminder.html (100%) rename get_together/templates/get_together/emails/{ => events}/reminder.txt (100%) rename get_together/templates/get_together/emails/{ => teams}/member_contact.html (100%) rename get_together/templates/get_together/emails/{ => teams}/member_contact.txt (100%) rename get_together/templates/get_together/emails/{ => teams}/member_invite.html (100%) rename get_together/templates/get_together/emails/{ => teams}/member_invite.txt (100%) rename get_together/templates/get_together/emails/{ => teams}/new_team_members.html (100%) rename get_together/templates/get_together/emails/{ => teams}/new_team_members.txt (100%) rename get_together/templates/get_together/emails/{ => users}/confirm_email.html (100%) rename get_together/templates/get_together/emails/{ => users}/confirm_email.txt (100%) diff --git a/get_together/management/commands/create_next_in_series.py b/get_together/management/commands/create_next_in_series.py index a67d041..1cde738 100644 --- a/get_together/management/commands/create_next_in_series.py +++ b/get_together/management/commands/create_next_in_series.py @@ -30,8 +30,8 @@ def email_host_new_event(event): 'site': Site.objects.get(id=1), } email_subject = '[GetTogether] New event: %s' % event.name - email_body_text = render_to_string('get_together/emails/event_from_series.txt', context) - email_body_html = render_to_string('get_together/emails/event_from_series.html', context) + email_body_text = render_to_string('get_together/emails/events/event_from_series.txt', context) + email_body_html = render_to_string('get_together/emails/events/event_from_series.html', context) email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') for attendee in Attendee.objects.filter(event=event, role=Attendee.HOST, user__user__account__is_email_confirmed=True): diff --git a/get_together/management/commands/send_daily_attendee_update.py b/get_together/management/commands/send_daily_attendee_update.py index e676b6b..b8b513f 100644 --- a/get_together/management/commands/send_daily_attendee_update.py +++ b/get_together/management/commands/send_daily_attendee_update.py @@ -46,8 +46,8 @@ def send_new_attendees(event, new_attendees): } email_subject = '[GetTogether] New event attendees' - email_body_text = render_to_string('get_together/emails/new_event_attendees.txt', context) - email_body_html = render_to_string('get_together/emails/new_event_attendees.html', context) + email_body_text = render_to_string('get_together/emails/events/new_event_attendees.txt', context) + email_body_html = render_to_string('get_together/emails/events/new_event_attendees.html', context) email_recipients = [host.email for host in hosts] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') diff --git a/get_together/management/commands/send_daily_member_update.py b/get_together/management/commands/send_daily_member_update.py index 4cb9700..2c5bbcf 100644 --- a/get_together/management/commands/send_daily_member_update.py +++ b/get_together/management/commands/send_daily_member_update.py @@ -46,8 +46,8 @@ def send_new_members(team, new_members): } email_subject = '[GetTogether] New team members' - email_body_text = render_to_string('get_together/emails/new_team_members.txt', context) - email_body_html = render_to_string('get_together/emails/new_team_members.html', context) + email_body_text = render_to_string('get_together/emails/teams/new_team_members.txt', context) + email_body_html = render_to_string('get_together/emails/teams/new_team_members.html', context) email_recipients = [admin.email for admin in admins] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') diff --git a/get_together/management/commands/send_email_confirmation_reminder.py b/get_together/management/commands/send_email_confirmation_reminder.py index e1e1e90..137170b 100644 --- a/get_together/management/commands/send_email_confirmation_reminder.py +++ b/get_together/management/commands/send_email_confirmation_reminder.py @@ -43,8 +43,8 @@ class Command(BaseCommand): 'confirmation_url': confirmation_url, } email_subject = '[GetTogether] Email confirmation reminder' - email_body_text = render_to_string('get_together/emails/confirm_email.txt', context) - email_body_html = render_to_string('get_together/emails/confirm_email.html', context) + email_body_text = render_to_string('get_together/emails/users/confirm_email.txt', context) + email_body_html = render_to_string('get_together/emails/users/confirm_email.html', context) email_recipients = [account.user.email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') success = send_mail( diff --git a/get_together/management/commands/send_event_reminder.py b/get_together/management/commands/send_event_reminder.py index 254da15..5f070c8 100644 --- a/get_together/management/commands/send_event_reminder.py +++ b/get_together/management/commands/send_event_reminder.py @@ -42,8 +42,8 @@ class Command(BaseCommand): } email_subject = '[GetTogether] Upcoming event reminder' - email_body_text = render_to_string('get_together/emails/reminder.txt', context) - email_body_html = render_to_string('get_together/emails/reminder.html', context) + email_body_text = render_to_string('get_together/emails/events/reminder.txt', context) + email_body_html = render_to_string('get_together/emails/events/reminder.html', context) email_recipients = [attendee.user.user.email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') diff --git a/get_together/templates/get_together/emails/attendee_contact.html b/get_together/templates/get_together/emails/events/attendee_contact.html similarity index 100% rename from get_together/templates/get_together/emails/attendee_contact.html rename to get_together/templates/get_together/emails/events/attendee_contact.html diff --git a/get_together/templates/get_together/emails/attendee_contact.txt b/get_together/templates/get_together/emails/events/attendee_contact.txt similarity index 100% rename from get_together/templates/get_together/emails/attendee_contact.txt rename to get_together/templates/get_together/emails/events/attendee_contact.txt diff --git a/get_together/templates/get_together/emails/attendee_invite.html b/get_together/templates/get_together/emails/events/attendee_invite.html similarity index 100% rename from get_together/templates/get_together/emails/attendee_invite.html rename to get_together/templates/get_together/emails/events/attendee_invite.html diff --git a/get_together/templates/get_together/emails/attendee_invite.txt b/get_together/templates/get_together/emails/events/attendee_invite.txt similarity index 100% rename from get_together/templates/get_together/emails/attendee_invite.txt rename to get_together/templates/get_together/emails/events/attendee_invite.txt diff --git a/get_together/templates/get_together/emails/event_comment.html b/get_together/templates/get_together/emails/events/event_comment.html similarity index 100% rename from get_together/templates/get_together/emails/event_comment.html rename to get_together/templates/get_together/emails/events/event_comment.html diff --git a/get_together/templates/get_together/emails/event_comment.txt b/get_together/templates/get_together/emails/events/event_comment.txt similarity index 100% rename from get_together/templates/get_together/emails/event_comment.txt rename to get_together/templates/get_together/emails/events/event_comment.txt diff --git a/get_together/templates/get_together/emails/event_from_series.html b/get_together/templates/get_together/emails/events/event_from_series.html similarity index 100% rename from get_together/templates/get_together/emails/event_from_series.html rename to get_together/templates/get_together/emails/events/event_from_series.html diff --git a/get_together/templates/get_together/emails/event_from_series.txt b/get_together/templates/get_together/emails/events/event_from_series.txt similarity index 100% rename from get_together/templates/get_together/emails/event_from_series.txt rename to get_together/templates/get_together/emails/events/event_from_series.txt diff --git a/get_together/templates/get_together/emails/new_event_attendees.html b/get_together/templates/get_together/emails/events/new_event_attendees.html similarity index 100% rename from get_together/templates/get_together/emails/new_event_attendees.html rename to get_together/templates/get_together/emails/events/new_event_attendees.html diff --git a/get_together/templates/get_together/emails/new_event_attendees.txt b/get_together/templates/get_together/emails/events/new_event_attendees.txt similarity index 100% rename from get_together/templates/get_together/emails/new_event_attendees.txt rename to get_together/templates/get_together/emails/events/new_event_attendees.txt diff --git a/get_together/templates/get_together/emails/reminder.html b/get_together/templates/get_together/emails/events/reminder.html similarity index 100% rename from get_together/templates/get_together/emails/reminder.html rename to get_together/templates/get_together/emails/events/reminder.html diff --git a/get_together/templates/get_together/emails/reminder.txt b/get_together/templates/get_together/emails/events/reminder.txt similarity index 100% rename from get_together/templates/get_together/emails/reminder.txt rename to get_together/templates/get_together/emails/events/reminder.txt diff --git a/get_together/templates/get_together/emails/member_contact.html b/get_together/templates/get_together/emails/teams/member_contact.html similarity index 100% rename from get_together/templates/get_together/emails/member_contact.html rename to get_together/templates/get_together/emails/teams/member_contact.html diff --git a/get_together/templates/get_together/emails/member_contact.txt b/get_together/templates/get_together/emails/teams/member_contact.txt similarity index 100% rename from get_together/templates/get_together/emails/member_contact.txt rename to get_together/templates/get_together/emails/teams/member_contact.txt diff --git a/get_together/templates/get_together/emails/member_invite.html b/get_together/templates/get_together/emails/teams/member_invite.html similarity index 100% rename from get_together/templates/get_together/emails/member_invite.html rename to get_together/templates/get_together/emails/teams/member_invite.html diff --git a/get_together/templates/get_together/emails/member_invite.txt b/get_together/templates/get_together/emails/teams/member_invite.txt similarity index 100% rename from get_together/templates/get_together/emails/member_invite.txt rename to get_together/templates/get_together/emails/teams/member_invite.txt diff --git a/get_together/templates/get_together/emails/new_team_members.html b/get_together/templates/get_together/emails/teams/new_team_members.html similarity index 100% rename from get_together/templates/get_together/emails/new_team_members.html rename to get_together/templates/get_together/emails/teams/new_team_members.html diff --git a/get_together/templates/get_together/emails/new_team_members.txt b/get_together/templates/get_together/emails/teams/new_team_members.txt similarity index 100% rename from get_together/templates/get_together/emails/new_team_members.txt rename to get_together/templates/get_together/emails/teams/new_team_members.txt diff --git a/get_together/templates/get_together/emails/confirm_email.html b/get_together/templates/get_together/emails/users/confirm_email.html similarity index 100% rename from get_together/templates/get_together/emails/confirm_email.html rename to get_together/templates/get_together/emails/users/confirm_email.html diff --git a/get_together/templates/get_together/emails/confirm_email.txt b/get_together/templates/get_together/emails/users/confirm_email.txt similarity index 100% rename from get_together/templates/get_together/emails/confirm_email.txt rename to get_together/templates/get_together/emails/users/confirm_email.txt diff --git a/get_together/views/events.py b/get_together/views/events.py index dd5908d..70c4b7a 100644 --- a/get_together/views/events.py +++ b/get_together/views/events.py @@ -295,8 +295,8 @@ def invite_attendee(email, event, sender): email = recipient.email email_subject = '[GetTogether] Invite to attend %s' % event.name - email_body_text = render_to_string('get_together/emails/attendee_invite.txt', context) - email_body_html = render_to_string('get_together/emails/attendee_invite.html', context) + email_body_text = render_to_string('get_together/emails/events/attendee_invite.txt', context) + email_body_html = render_to_string('get_together/emails/events/attendee_invite.html', context) email_recipients = [email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') @@ -326,8 +326,8 @@ def contact_attendee(attendee, body, sender): 'site': Site.objects.get(id=1), } email_subject = '[GetTogether] Message about %s' % attendee.event.name - email_body_text = render_to_string('get_together/emails/attendee_contact.txt', context) - email_body_html = render_to_string('get_together/emails/attendee_contact.html', context) + email_body_text = render_to_string('get_together/emails/events/attendee_contact.txt', context) + email_body_html = render_to_string('get_together/emails/events/attendee_contact.html', context) email_recipients = [attendee.user.user.email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') @@ -417,8 +417,8 @@ def send_comment_emails(comment): 'site': Site.objects.get(id=1), } email_subject = '[GetTogether] Comment on %s' % comment.event.name - email_body_text = render_to_string('get_together/emails/event_comment.txt', context) - email_body_html = render_to_string('get_together/emails/event_comment.html', context) + email_body_text = render_to_string('get_together/emails/events/event_comment.txt', context) + email_body_html = render_to_string('get_together/emails/events/event_comment.html', context) email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') for attendee in comment.event.attendees.filter(user__account__is_email_confirmed=True): diff --git a/get_together/views/new_user.py b/get_together/views/new_user.py index 03ca6b3..9f630ec 100644 --- a/get_together/views/new_user.py +++ b/get_together/views/new_user.py @@ -144,8 +144,8 @@ def user_send_confirmation_email(request): 'confirmation_url': confirmation_url, } email_subject = '[GetTogether] Confirm email address' - email_body_text = render_to_string('get_together/emails/confirm_email.txt', context, request) - email_body_html = render_to_string('get_together/emails/confirm_email.html', context, request) + email_body_text = render_to_string('get_together/emails/users/confirm_email.txt', context, request) + email_body_html = render_to_string('get_together/emails/users/confirm_email.html', context, request) email_recipients = [request.user.email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') success = send_mail( diff --git a/get_together/views/teams.py b/get_together/views/teams.py index 4f0217b..e645ab9 100644 --- a/get_together/views/teams.py +++ b/get_together/views/teams.py @@ -239,8 +239,8 @@ def invite_member(email, team, sender): 'site': Site.objects.get(id=1), } email_subject = '[GetTogether] Invite to join %s' % team - email_body_text = render_to_string('get_together/emails/member_invite.txt', context) - email_body_html = render_to_string('get_together/emails/member_invite.html', context) + email_body_text = render_to_string('get_together/emails/teams/member_invite.txt', context) + email_body_html = render_to_string('get_together/emails/teams/member_invite.html', context) email_recipients = [email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community') @@ -271,8 +271,8 @@ def contact_member(member, body, sender): 'site': Site.objects.get(id=1), } email_subject = '[GetTogether] Message from %s' % member.team - email_body_text = render_to_string('get_together/emails/member_contact.txt', context) - email_body_html = render_to_string('get_together/emails/member_contact.html', context) + email_body_text = render_to_string('get_together/emails/teams/member_contact.txt', context) + email_body_html = render_to_string('get_together/emails/teams/member_contact.html', context) email_recipients = [member.user.user.email] email_from = getattr(settings, 'DEFAULT_FROM_EMAIL', 'noreply@gettogether.community')