diff --git a/emails/views.py b/emails/views.py index a333d8a..ab4f192 100644 --- a/emails/views.py +++ b/emails/views.py @@ -15,6 +15,8 @@ from hackathons.models import Hackathon, Sponsorship, Lead from hackathons.views.sponsorships import combine_lead_and_contacts +from shared import packet + from .models import Email from .forms import ComposeFromContactsForm, ComposeFromCompanyForm, ComposeFromIndustryForm, EmailChangeTypeForm @@ -159,7 +161,7 @@ def send_message(request, h_pk, pk): message = email.render_body(contact) packet_file = None if email.attach_packet: - packet_file = os.path.join(settings.PROJECT_ROOT, 'static', settings.SPONSORSHIP_PACKET_FILE) + packet_file = packet.get_packet_file_path() print(f"SENDING: {email.subject} TO: {contact} ({contact.email}) ATTACHMENT: {packet_file}") print(send_email_now(email.subject, message, contact.email, packet_file)) diff --git a/website/settings.py b/website/settings.py index 25b51e9..cfbc1b2 100644 --- a/website/settings.py +++ b/website/settings.py @@ -55,7 +55,7 @@ def str_environ(name, default=None): # The local name of the sponsorship packet, to be stored in the website/static # folder. If this file exists, it will be used. Otherwise, it will be # redownloaded from SPONSORSHIP_PACKET_URL. -SPONSORSHIP_PACKET_FILE = str_environ("SPONSORSHIP_PACKET_FILE") +SPONSORSHIP_PACKET_FILE = str_environ("SPONSORSHIP_PACKET_FILE", "sponsorship.pdf") if not PRODUCTION and 'DEBUG' not in os.environ: DEBUG = True