Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for templates from MEDIA_ROOT #25

Open
frague59 opened this issue Aug 27, 2018 · 1 comment
Open

Support for templates from MEDIA_ROOT #25

frague59 opened this issue Aug 27, 2018 · 1 comment

Comments

@frague59
Copy link

frague59 commented Aug 27, 2018

  • Templated-docs version: 0.3.1
  • Python version: Python 3.6.6rc1+
  • Operating System: Debian testing (buster)

Description

I'm writing an application where users can provide there own templates, via uploading them.

What I Did

from templated_docs import fill_template
from templated_docs.http import FileResponse

template_path = "/home/.../template.odt"
context = {... my pretty context ...}
filename = fill_template(template_path, context, "pdf")
pretty_name = "my_pretty_name.pdf"
return FileResponse(filename, pretty_name)

which raises a "TemplateDoesNotExist" exception.

I could use an external app to load the template (django-dbtemplate for instance), but loading the template right from the full path should be simpler.

Thanks !

@frague59
Copy link
Author

Hi,

In fact, the need is more a low-level API to load separate the template loading from the rendering, which is for now performed in the same function, aka. fill_template

I'll try to make a PR about that...

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant