Additional template engines for Django.
Project description
django-template-engines
Description
Additional template engines for Django (ODT for now).
How to use a specific template backend
In the settings, add:
INSTALLED_APPS = [
...
'template_engines',
]
...
TEMPLATES = [
{
'BACKEND': 'template_engines.backends.odt.OdtEngine',
'DIRS': [
],
'APP_DIRS': True,
},
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
A view exemple
from django.views.generic.detail import DetailView
class TemplateView(DetailView):
queryset = AModel.objects.all()
template_engine = 'odt'
content_type = 'application/vnd.oasis.opendocument.text'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['image'] = {'content': open(path, 'rb').read()}
return context
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-template-engines-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a5f7b47475803c9d2e7a3abba9335f1444b518126e6f79ffcfd5c0498c2b5c1 |
|
MD5 | 73b58be0c20a53830006829b2cc1421a |
|
BLAKE2b-256 | d92eb4f60f924fb95845c1990e303fedc8aa43a4e8786fc01407f52e714e1551 |