diff --git a/rowers/tasks.py b/rowers/tasks.py index c2d05fe5..262ee3fe 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -26,7 +26,7 @@ from rowsandall_app.settings import SITE_URL from rowsandall_app.settings_dev import SITE_URL as SITE_URL_DEV from rowsandall_app.settings import PROGRESS_CACHE_SECRET from rowsandall_app.settings import SETTINGS_NAME -os.environ.setdefault('DJANGO_SETTINGS_MODULE', SETTINGS_NAME) + import pandas as pd @@ -49,9 +49,11 @@ from django.core.mail import ( send_mail, EmailMessage,EmailMultiAlternatives, ) -from django.template.loader import get_template + from django.template import Context from django.db.utils import OperationalError +from jinja2 import Template,Environment,FileSystemLoader +env = Environment(loader = FileSystemLoader(["rowers/templates"])) import datautils import utils @@ -72,8 +74,8 @@ def textify(html): def send_template_email(from_email,to_email,subject, template,context, *args,**kwargs): - - htmly = get_template(template) + + htmly = env.get_template(template) html_content = htmly.render(context) text_content = textify(html_content) @@ -511,14 +513,13 @@ def handle_sendemail_unrecognizedowner(useremail, userfirstname, fullemail = useremail subject = "Unrecognized file from Rowsandall.com" - htmly = get_template('unrecognizedemail.html') d = {'first_name':userfirstname} from_email = 'Rowsandall ' res = send_template_email(from_email,[fullemail], - subject,'csvemail.html',d, + subject,'unrecognizedemail.html',d, **kwargs) return 1 diff --git a/rowers/templates/breakthroughemail.html b/rowers/templates/breakthroughemail.html index bd1107ab..962ae1f6 100644 --- a/rowers/templates/breakthroughemail.html +++ b/rowers/templates/breakthroughemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

@@ -46,9 +44,9 @@ {% for set in btvalues %} - {{ set|lookup:"delta" }} - {{ set|lookup:"cpvalue" }} - {{ set|lookup:"pwr" }} + {{ set["delta"] }} + {{ set["cpvalue"] }} + {{ set["pwr"] }} {% endfor %} diff --git a/rowers/templates/csvemail.html b/rowers/templates/csvemail.html index edb5ec7e..5c2737af 100644 --- a/rowers/templates/csvemail.html +++ b/rowers/templates/csvemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/emailbase.html b/rowers/templates/emailbase.html index 4f457f2b..cb160fb3 100644 --- a/rowers/templates/emailbase.html +++ b/rowers/templates/emailbase.html @@ -1,8 +1,6 @@ -{% load staticfiles %} -{% load rowerfilters %} diff --git a/rowers/templates/gpxemail.html b/rowers/templates/gpxemail.html index edb5ec7e..5c2737af 100644 --- a/rowers/templates/gpxemail.html +++ b/rowers/templates/gpxemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/hardemail.html b/rowers/templates/hardemail.html index 0ca5cf10..20641e60 100644 --- a/rowers/templates/hardemail.html +++ b/rowers/templates/hardemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/otwpoweremail.html b/rowers/templates/otwpoweremail.html index 8b90a830..18cdd1cd 100644 --- a/rowers/templates/otwpoweremail.html +++ b/rowers/templates/otwpoweremail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/tcxemail.html b/rowers/templates/tcxemail.html index edb5ec7e..5c2737af 100644 --- a/rowers/templates/tcxemail.html +++ b/rowers/templates/tcxemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/teamdropemail.html b/rowers/templates/teamdropemail.html index d8255b15..d39b41df 100644 --- a/rowers/templates/teamdropemail.html +++ b/rowers/templates/teamdropemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/teaminviteacceptemail.html b/rowers/templates/teaminviteacceptemail.html index 86754ee1..05620326 100644 --- a/rowers/templates/teaminviteacceptemail.html +++ b/rowers/templates/teaminviteacceptemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ managername }},

diff --git a/rowers/templates/teaminviteemail.html b/rowers/templates/teaminviteemail.html index f0895252..f6b2826b 100644 --- a/rowers/templates/teaminviteemail.html +++ b/rowers/templates/teaminviteemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ name }},

diff --git a/rowers/templates/teaminviterejectemail.html b/rowers/templates/teaminviterejectemail.html index 30ab689a..0587d148 100644 --- a/rowers/templates/teaminviterejectemail.html +++ b/rowers/templates/teaminviterejectemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ managername }},

diff --git a/rowers/templates/teamrejectemail.html b/rowers/templates/teamrejectemail.html index 34422898..3dbcd416 100644 --- a/rowers/templates/teamrejectemail.html +++ b/rowers/templates/teamrejectemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/teamremoveemail.html b/rowers/templates/teamremoveemail.html index 64c92d62..44979f75 100644 --- a/rowers/templates/teamremoveemail.html +++ b/rowers/templates/teamremoveemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/teamrequestemail.html b/rowers/templates/teamrequestemail.html index dd436837..0525d1d8 100644 --- a/rowers/templates/teamrequestemail.html +++ b/rowers/templates/teamrequestemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/teamresponseemail.html b/rowers/templates/teamresponseemail.html index d0def71a..3b7d181a 100644 --- a/rowers/templates/teamresponseemail.html +++ b/rowers/templates/teamresponseemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ name }},

diff --git a/rowers/templates/teamwelcomeemail.html b/rowers/templates/teamwelcomeemail.html index d255002c..53c9d1b3 100644 --- a/rowers/templates/teamwelcomeemail.html +++ b/rowers/templates/teamwelcomeemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},

diff --git a/rowers/templates/unrecognizedemail.html b/rowers/templates/unrecognizedemail.html index bc6706ab..539b728e 100644 --- a/rowers/templates/unrecognizedemail.html +++ b/rowers/templates/unrecognizedemail.html @@ -1,6 +1,4 @@ {% extends "emailbase.html" %} -{% load staticfiles %} -{% load rowerfilters %} {% block body %}

Dear {{ first_name }},