Skip to main content

Templated-docs

https://badge.fury.io/py/templated-docs.svg https://img.shields.io/travis/kiawin/templated-docs.svg Documentation Status Dependencies

Generate templated documents within Django in any format supported by LibreOffice: texts, spreadsheets, presentations etc.

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:

https://github.com/kiawin/templated-docs/raw/master/docs/document-template.png

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:

https://github.com/kiawin/templated-docs/raw/master/docs/generated-document.png

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.

Metadata

Release files for templateddocs 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for templateddocs 0.3.4
File Size Uploaded Provenance Actions
templateddocs-0.3.4.tar.gz 48.4 kB Without provenance Details for templateddocs-0.3.4.tar.gz

Release files / templateddocs-0.3.4.tar.gz

Download URL templateddocs-0.3.4.tar.gz
Size 48.4 kB
Tags Source
SHA-256 checksum
How to use checksums
15d5ea7e397a0acd08a59a022e9656c4aeb64135ca51d2afaa8c6261c67ed20b
BLAKE2b-256 checksum
How to use checksums
ab2497c989d71465cbf2d3dda953e60e5f561c4b8bb5c0303ff672aab83f74bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for templateddocs 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page