Merge branch 'feature/emailtemplates' into develop
This commit is contained in:
@@ -33,25 +33,23 @@ queuelow = django_rq.get_queue('low')
|
|||||||
queuehigh = django_rq.get_queue('default')
|
queuehigh = django_rq.get_queue('default')
|
||||||
|
|
||||||
# Sends a confirmation with a link to the workout
|
# Sends a confirmation with a link to the workout
|
||||||
|
from rowers.emails import send_template_email
|
||||||
|
|
||||||
def send_confirm(user, name, link, options):
|
def send_confirm(user, name, link, options):
|
||||||
""" Send confirmation email to user when email has been processed """
|
d = {
|
||||||
|
'first_name':user.first_name,
|
||||||
|
'name':name,
|
||||||
|
'link':link,
|
||||||
|
}
|
||||||
|
|
||||||
fullemail = user.email
|
fullemail = user.email
|
||||||
subject = 'Workout added: ' + name
|
subject = 'New Workout Added: '+name
|
||||||
message = 'Dear ' + user.first_name + ',\n\n'
|
|
||||||
message += "Your workout has been added to Rowsandall.com.\n"
|
|
||||||
message += "Link to workout: " + link + "\n\n"
|
|
||||||
message += "Best Regards, the Rowsandall Team"
|
|
||||||
|
|
||||||
if options:
|
res = send_template_email('Rowsandall <info@rowsandall.com>',
|
||||||
message += "\n\n" + str(options)
|
[fullemail],
|
||||||
|
subject,'confirmemail.html',
|
||||||
email = EmailMessage(subject, message,
|
d
|
||||||
'Rowsandall <info@rowsandall.com>',
|
)
|
||||||
[fullemail])
|
|
||||||
|
|
||||||
res = email.send()
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
imagename=imagename
|
imagename=imagename
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
if workoutid and not testing:
|
if workoutid:
|
||||||
email_sent = send_confirm(
|
email_sent = send_confirm(
|
||||||
rower.user, title, link,
|
rower.user, title, link,
|
||||||
uploadoptions
|
uploadoptions
|
||||||
@@ -92,13 +92,12 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
if not testing:
|
time.sleep(10)
|
||||||
time.sleep(10)
|
if workoutid:
|
||||||
if workoutid:
|
email_sent = send_confirm(
|
||||||
email_sent = send_confirm(
|
rower.user, title, link,
|
||||||
rower.user, title, link,
|
uploadoptions
|
||||||
uploadoptions
|
)
|
||||||
)
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
18
rowers/templates/confirmemail.html
Normal file
18
rowers/templates/confirmemail.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{% extends "emailbase.html" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<p>Dear <strong>{{ first_name }}</strong>,</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Your workout has been added to Rowsandall.com.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Link to workout: {{ link }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Best Regards, the Rowsandall Team
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user