FIX: do not escape html entities in plain text templates.

This commit is contained in:
2018-11-27 10:11:18 +01:00
parent cec64de400
commit 7f54939b90
3 changed files with 17 additions and 2 deletions

View File

@@ -15,6 +15,21 @@ INSTALLED_APPS += [
'dav_events',
]
TEMPLATES += [
{
'NAME': 'PLAINTEXT',
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'autoescape': False,
'context_processors': [
'django.template.context_processors.debug',
],
},
},
]
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_VAR_DIR, 'db', 'devel.sqlite3'),

View File

@@ -28,7 +28,7 @@ class AbstractMail(object):
def _get_template(self):
if not self._template_name:
raise ImproperlyConfigured('%s._template_name ist not set.', self.__class__.__name__)
return get_template(self._template_name)
return get_template(self._template_name, using='PLAINTEXT')
def _get_context_data(self, extra_context=None):
app_config = apps.get_containing_app_config(__package__)

View File

@@ -553,7 +553,7 @@ class Event(models.Model):
template_name = 'default.txt'
template_path = os.path.join('dav_events', 'event', template_name)
template = get_template(template_path)
template = get_template(template_path, using='PLAINTEXT')
return template.render(self.get_template_context({'show_internal_fields': show_internal_fields}))
def render_as_html(self):