From 0b7e0b7f04d32276ba4a4039013a52122278f475 Mon Sep 17 00:00:00 2001 From: Alex Seeholzer Date: Tue, 2 Jun 2015 16:57:52 +0200 Subject: [PATCH] changes in templating engine that worked for django 1.8 --- helpdesk/lib.py | 6 ++++-- helpdesk/views/staff.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 820e3b41..cd9aa8c5 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -103,13 +103,15 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b html_txt = html_txt.replace('\r\n', '
') context['comment'] = mark_safe(html_txt) + from django.template import engines + # get_template_from_string was removed in Django 1.8 http://django.readthedocs.org/en/1.8.x/ref/templates/upgrading.html - html_part = Engine().from_string( + html_part = engines['django'].from_string( "{%% extends '%s' %%}{%% block title %%}%s{%% endblock %%}{%% block content %%}%s{%% endblock %%}" % (email_html_base_file, t.heading, t.html) ).render(context) # get_template_from_string was removed in Django 1.8 http://django.readthedocs.org/en/1.8.x/ref/templates/upgrading.html - subject_part = Engine().from_string( + subject_part = engines['django'].from_string( HELPDESK_EMAIL_SUBJECT_TEMPLATE % { "subject": t.subject, }).render(context) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index e3870abe..e42dd162 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -350,8 +350,8 @@ def update_ticket(request, ticket_id, public=False): # get_template_from_string was removed in Django 1.8 http://django.readthedocs.org/en/1.8.x/ref/templates/upgrading.html - from django.template import Engine - comment = Engine().from_string(comment).render(Context(context)) + from django.template import engines + comment = engines['django'].from_string(comment).render(Context(context)) if owner is -1 and ticket.assigned_to: owner = ticket.assigned_to.id