Private
Public Access
1
0

fixing using jinja2

This commit is contained in:
Sander Roosendaal
2018-03-19 23:01:32 +01:00
parent e162cbd9b5
commit 9d46190e85
18 changed files with 10 additions and 43 deletions

View File

@@ -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 <info@rowsandall.com>'
res = send_template_email(from_email,[fullemail],
subject,'csvemail.html',d,
subject,'unrecognizedemail.html',d,
**kwargs)
return 1