I have created a rich text area using tinymce. I have now saved this to my database and want to display it. It gets saved in the database as html with tags, etc. To display it I have tried:
In views:
content = get_content_from_db() render_to_response("template.html", {"content":content})
In template:
{{content}}
This shows the content with the tags like so:
<strong>My text</strong>
instead of just displaying the text as bold.
I have also tried using the verbatim tag, but this (doh!) displays as:
{{content}}
How should I do this? Do I need to save it differently? I save it the way I save any other TextArea except the field is a blob.
Django has convenient built-in tools that you can use to produce some common non-HTML content: RSS/Atom syndication feeds. Sitemaps (an XML format originally developed by Google that gives hints to search engines)
From the documentation: {% extends variable %} uses the value of variable. If the variable evaluates to a string, Django will use that string as the name of the parent template. If the variable evaluates to a Template object, Django will use that object as the parent template.
Use safe
filter
{{ content|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