Made static items into variables

This commit is contained in:
Alexander Taylor
2021-07-04 14:57:47 -04:00
parent 5594f26332
commit 19c7ff90e8
3 changed files with 19 additions and 15 deletions

View File

@@ -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 <happilyeverafter@example.com>'
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

View File

@@ -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']):

View File

@@ -19,7 +19,7 @@
<td style="font-size: 35px; font-family: Palatino, serif; color: {{ font_color }}; padding-top: 30px; font-weight:bolder;"
class="padding-copy"
align="center">
July 2, 2016
{{ date }}
</td>
</tr>
<tr>
@@ -27,7 +27,7 @@
class="padding-copy"
align="center">
{{ couple }}<br>
Niagara-on-the-Lake, Ontario, Canada<br>
{{ location }}<br>
</td>
</tr>
</tbody>