I understand that this is a little perverse, but I have a legacy database with some entries as formatted html. I'd like to just push this into my django templates as ASCII and let the browser display it.
Django kindly converts my fields to unicode, and so the browser displays the entire text <p> </p>
etc. intact.
I was hoping that there might be a template flag {{ obj.text|ascii }}
or something that might fix this for me - does anyone have any ideas? Thanks.
{{ foo }} - this is a placeholder in the template, for the variable foo that is passed to the template from a view. {% %} - when text is surrounded by these delimiters, it means that there is some special function or code running, and the result of that will be placed here.
The include tag allows you include a template inside the current template. This is useful when you have a block of content that are the same for many pages.
The Django template language doesn't have an equivalent of Jinja2 tests.
render_to_string is a callable within the django. template. loader module of the Django project. get_template and select_template are a couple of other callables within the django. template.
From http://docs.djangoproject.com/en/dev/ref/templates/builtins/ what you want is:
{{ obj.text|safe }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With