Render as Template
A template tag for Django that takes a string and renders as it if it was a template. Uses the current Engine and RequestContext.
Include in your template by adding {% load render_as_template %}. Use by adding {% render_as_template some_var %} where some_var is a context variable that acts as a template.
Example: assume your view exposes two variables in the context: my_string and my_template.
Then, if:
my_string == u"http://example.com/", and
my_template == u"Go to {{ my_string|urlize }}!"", and
the_views_template.html == u"{% render_as_template my_template %}"
Then final output would be:
Go to <a href="http://example.com/" rel="nofollow">http://example.com/</a>!
Mixed with flatpages this lets you create powerful websites, although make sure you trust the people who can edit those flatpages because who knows what kind of dangerous security holes this thing will create! Also if your template includes HTML don’t forget to mark it safe:
{% render_as_template my_template|safe %}
Metadata
Release files for django-render-as-template 1.0.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 | |
|---|---|---|---|
| django-render-as-template-1.0.0.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_render_as_template-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 6.5 kB
Release files / django-render-as-template-1.0.0.tar.gz
| Download URL | django-render-as-template-1.0.0.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4cfe26c67a2e8f057fbd88f53aa986392432d294e1c036f68a6ca8bb5203187
|
|
BLAKE2b-256 checksum How to use checksums |
5168d7f02461db3b935935700972c4a2dd27087f5fd9a8b13d488d9c7fd9a5f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_render_as_template-1.0.0-py2.py3-none-any.whl
| Download URL | django_render_as_template-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7ebc160b6c69e2d39a25a6aef51b411000b172c917dc47f119b525bfa6b6f0b2
|
|
BLAKE2b-256 checksum How to use checksums |
8d8dbf9fb6af8fbcdcf7a24103961b95dc5217397e80acec39be0eb3377e4aaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |