Use Jinja2 as the template engine

Use Jinja2 to render the templates of the indexing,
workflows, smart links, user mailer and metadata apps.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-11-25 02:13:26 -04:00
parent 42d434f7bb
commit 6a7cd09bc1
9 changed files with 31 additions and 28 deletions

View File

@@ -2,8 +2,9 @@ from __future__ import absolute_import, unicode_literals
import logging
from jinja2 import Template
from django.db import models, transaction
from django.template import Context, Template
from django.urls import reverse
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext, ugettext_lazy as _
@@ -264,9 +265,9 @@ class IndexTemplateNode(MPTTModel):
)
try:
context = Context({'document': document})
context = {'document': document}
template = Template(self.expression)
result = template.render(context=context)
result = template.render(**context)
except Exception as exception:
logger.debug('Evaluating error: %s', exception)
error_message = _(