From 19c7ff90e8b4147ee20003bb61e270918487d4dc Mon Sep 17 00:00:00 2001 From: Alexander Taylor <31589434+dillwishlist@users.noreply.github.com> Date: Sun, 4 Jul 2021 14:57:47 -0400 Subject: [PATCH] Made static items into variables --- bigday/settings.py | 16 +++++++++++----- guests/save_the_date.py | 14 ++++++-------- .../guests/email_templates/save_the_date.html | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bigday/settings.py b/bigday/settings.py index 77cd9d3..30bb40c 100644 --- a/bigday/settings.py +++ b/bigday/settings.py @@ -126,19 +126,25 @@ STATICFILES_DIRS = ( os.path.join('bigday', 'static'), ) +# This is used in a few places where the names of the couple are used +BRIDE_AND_GROOM = 'Bride and Groom' +# base address for all emails +DEFAULT_WEDDING_EMAIL = 'happilyeverafter@example.com' # the address your emails (save the dates/invites/etc.) will come from -DEFAULT_WEDDING_FROM_EMAIL = 'You and Your Partner ' +DEFAULT_WEDDING_FROM_EMAIL = BRIDE_AND_GROOM + ' ' + DEFAULT_WEDDING_EMAIL # change to 'address@domain.tld' # the default reply-to of your emails -DEFAULT_WEDDING_REPLY_EMAIL = 'happilyeverafter@example.com' +DEFAULT_WEDDING_REPLY_EMAIL = DEFAULT_WEDDING_EMAIL # change to 'address@domain.tld' +# the location of your wedding +WEDDING_LOCATION = 'North Pole, USA' +# the date of your wedding +WEDDING_DATE = 'January 1st, 1969' # when sending test emails it will use this address DEFAULT_WEDDING_TEST_EMAIL = DEFAULT_WEDDING_FROM_EMAIL -# This is used in a few places where the names of the couple are used -BRIDE_AND_GROOM = 'Cory and Rowena' # This is used in links in save the date / invitations -WEDDING_WEBSITE_URL = 'http://thehappycouple.com' +WEDDING_WEBSITE_URL = 'http://bigday.thehappycouple.com' WEDDING_CC_LIST = [] # put email addresses here if you want to cc someone on all your invitations # change to a real email backend in production diff --git a/guests/save_the_date.py b/guests/save_the_date.py index 3c92ce1..4b3ab73 100644 --- a/guests/save_the_date.py +++ b/guests/save_the_date.py @@ -108,10 +108,11 @@ def get_save_the_date_context(template_id): context['rsvp_address'] = settings.DEFAULT_WEDDING_REPLY_EMAIL context['site_url'] = settings.WEDDING_WEBSITE_URL context['couple'] = settings.BRIDE_AND_GROOM - context['page_title'] = 'Cory and Rowena - Save the Date!' + context['location'] = settings.WEDDING_LOCATION + context['date'] = settings.WEDDING_DATE + context['page_title'] = (settings.BRIDE_AND_GROOM + ' - Save the Date!') context['preheader_text'] = ( - "The date that you've eagerly been waiting for is finally here. " - "Cory and Ro are getting married! Save the date!" + "The date that you've eagerly been waiting for is finally here. " + settings.BRIDE_AND_GROOM + " are getting married! Save the date!" ) return context @@ -122,13 +123,10 @@ def send_save_the_date_email(context, recipients, test_only=False): context['site_url'] = settings.WEDDING_WEBSITE_URL context['couple'] = settings.BRIDE_AND_GROOM template_html = render_to_string(SAVE_THE_DATE_TEMPLATE, context=context) - template_text = "Save the date for {}'s wedding! July 2, 2016. Niagata-on-the-Lake, Ontario, Canada".format( - settings.BRIDE_AND_GROOM - ) + template_text = ("Save the date for " + settings.BRIDE_AND_GROOM + "'s wedding! " + settings.WEDDING_DATE + ". " + settings.WEDDING_LOCATION) subject = 'Save the Date!' # https://www.vlent.nl/weblog/2014/01/15/sending-emails-with-embedded-images-in-django/ - msg = EmailMultiAlternatives(subject, template_text, settings.DEFAULT_WEDDING_FROM_EMAIL, recipients, - reply_to=[settings.DEFAULT_WEDDING_REPLY_EMAIL]) + msg = EmailMultiAlternatives(subject, template_text, settings.DEFAULT_WEDDING_FROM_EMAIL, recipients, reply_to=[settings.DEFAULT_WEDDING_REPLY_EMAIL]) msg.attach_alternative(template_html, "text/html") msg.mixed_subtype = 'related' for filename in (context['header_filename'], context['main_image']): diff --git a/guests/templates/guests/email_templates/save_the_date.html b/guests/templates/guests/email_templates/save_the_date.html index f8208f8..c7157d1 100644 --- a/guests/templates/guests/email_templates/save_the_date.html +++ b/guests/templates/guests/email_templates/save_the_date.html @@ -19,7 +19,7 @@ - July 2, 2016 + {{ date }} @@ -27,7 +27,7 @@ class="padding-copy" align="center"> {{ couple }}
- Niagara-on-the-Lake, Ontario, Canada
+ {{ location }}