templated-docs icon indicating copy to clipboard operation
templated-docs copied to clipboard

Allow Absolute Path for Odt Models, not only from template folder.

Open dudanogueira opened this issue 9 years ago • 2 comments

Not really a Issue, but more a feature: Allow absolute path for template odt, as I would like to not use a template from template folder.

One might be able to get a file from a Model FileField and use it as the odt model. This may be accomplished by trying to get the template from the provided path first, if it fails, try loading from the template folder (or vice versa).

I'll try to implement this on my fork and pull request it later.

Thanks for this awesome project, by the way. Also saw a nice jabber related project of yours. I am also interested on that one as I have some solution that sends. I'll test it later against the latest Spark Server.

dudanogueira avatar Jul 27 '16 22:07 dudanogueira

The idea is quite reasonable, but it's achievable right now without altering the code. If you want to serve templates outside your Django installation path (which can be the epic security hole btw), you can just configure the filesystem loader's DIRS setting appropriately:

TEMPLATES = [{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [MEDIA_ROOT], # allow templates to be found among the uploaded files
}]

Please let me know what do you think about this way of tackling the problem. Does it work for you?

alexmorozov avatar Aug 13 '16 20:08 alexmorozov

In regard to django-jabber - sure, give it a go, I'd be happy to hear some suggestions from you. We have it running in production against the Openfire for several years, so far so good.

alexmorozov avatar Aug 13 '16 20:08 alexmorozov