Private
Public Access
1
0

Merge tag 'v6.29' into develop

moving to jinja for email templates
This commit is contained in:
Sander Roosendaal
2018-03-19 23:03:21 +01:00
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

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>
@@ -46,9 +44,9 @@
</tr>
{% for set in btvalues %}
<tr>
<th>{{ set|lookup:"delta" }}</th>
<th>{{ set|lookup:"cpvalue" }}</th>
<th>{{ set|lookup:"pwr" }}</th>
<th>{{ set["delta"] }}</th>
<th>{{ set["cpvalue"] }}</th>
<th>{{ set["pwr"] }}</th>
</tr>
{% endfor %}
</table>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,8 +1,6 @@
<html>
<body>
<font face="verdana, sans-serif">
{% load staticfiles %}
{% load rowerfilters %}
<img src="https://rowsandall.com/static/img/logoemail.png" height="50">

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ managername }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ managername }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>

View File

@@ -1,6 +1,4 @@
{% extends "emailbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>