Additional template engines for Django.
Project description
django-template-engines
Description
Additional template engines for Django.
How to use a specific template backend
In the settings, add:
INSTALLED_APPS = [
...
'template_engines',
]
...
TEMPLATES = [
{
'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',
],
},
},
{
'BACKEND': 'template_engines.backends.odt.OdtEngine',
...,
},
]
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
1.2.6 (2019-09-12)
Fixes:
- conditions to determine mimetype template
1.2.5 (2019-09-12)
Fixes:
- packaging
1.2.4 (2019-09-12)
Fixes:
- Allow mimetype zip for DOCX and ODT
1.2.3 (2019-09-11)
Fixes:
- Compatibility with non FileStorageBackend
1.2.2
Update
- Pillow>=5.4.1
1.2.1
requests
is no longer needed.
1.2.0
From now on, you can specify bold text.
1.1.3
Image loaders can now take width and height as dxa
, px
, pt
, in
, cm
and emu
.
1.1.2
Add:
- A template tag to load images into a docx template (
docx_image_loader
).
1.0.0
Add:
- Docx template engine (
template_engines.backends.docx.DocxEngine
). - Docx template class (
template_engines.backends.odt.DocxTemplate
).
0.0.4
- Abstract template engine for writing custom engines
(
template_engines.backends.abstract.AbstractEngine
). - Abstract template class for writing custom template classes
(
template_engines.backends.abstract.AbstractTemplate
). - Odt template engine (
template_engines.backends.odt.OdtEngine
). - Odt template class (
template_engines.backends.odt.OdtTemplate
). - A template tag to load images into an odt template (
odt_image_loader
).
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-1.2.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3f3d4ba1d9509f6e10ec9d8e836cd1f4ed8e817f244602a01ae0bf7495bf073 |
|
MD5 | 49d985bab9557634c874f5a7202b6c7b |
|
BLAKE2b-256 | 7b775d0fd208dca1156e0eca0e3dba8b4a04e619084139886a705d5147f7de77 |