Generate templated documents within Django in any format supported by LibreOffice: texts, spreadsheets, presentations etc.
Free software: MIT license
Documentation: https://templated-docs.readthedocs.io.
Requirements
Python 2.7 or 3.4+
Django >= 1.8
A recent LibreOffice version (>=4.3.0) supporting LibreOfficeKit API.
Example usage
Create a sample.odt document (make sure it’s in OpenDocument format) and put it in your Django templates folder. It should look something like this:
Then write a view to generate documents from this template:
from templated_docs import fill_template from templated_docs.http import FileResponse def get_document(request): """ A view to get a document filled with context variables. """ context = {'user': request.user} # Just an example filename = fill_template('sample.odt', context, output_format='pdf') visible_filename = 'greeting.pdf' return FileResponse(filename, visible_filename)
Navigate to the url your view is connected to, and you’ll see a rendered and converted document:
For more examples, see the examples/ subfolder in the repository. More detailed documentation is available on https://templated-docs.readthedocs.io.
Credits
Templated-docs was written by Alex Morozov.
As the repository is left idle for 2 years, Sian Lerk Lau has forked and resume the task of updating the module.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Release files for jpt-templated-docs 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jpt-templated-docs-0.4.0.tar.gz | 48.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jpt_templated_docs-0.4.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size:67.2 kB
Release files / jpt-templated-docs-0.4.0.tar.gz
| Download URL | jpt-templated-docs-0.4.0.tar.gz |
|---|---|
| Size | 48.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5a3f052915237b545d5f98e5d6073654adca0f08264a8a057c31717015e7648
|
|
BLAKE2b-256 checksum How to use checksums |
8d2b993cc1946ee10ba1a3bf07ff7ab8e50ec5d9398ed749dc42bf47b1a3aa50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Release files / jpt_templated_docs-0.4.0-py2.py3-none-any.whl
| Download URL | jpt_templated_docs-0.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f9466715883ea3d4139caf425864d8458df6e748ad63a931b9f36758233ce11d
|
|
BLAKE2b-256 checksum How to use checksums |
287d2ce83793df511ffda33d453f808440d95e6caddfd90948c43c25a0460e3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|