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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 032e2f635f342488b23d109f67941282d2dd3fb1cce3cdc71892f1b56ed7ba32 |
|
MD5 | 2be1699403c40362d9943bdc1cf7d294 |
|
BLAKE2b-256 | b404ac360b9196661a59938e7b8c588f5e534906697da3032ddde565c2580b46 |