Reputation: 4353
I have a model:
class Product(db.Model):
...
file: db.BlobProperty() # Uploaded HTML file for product description
...
and I would like to display it in a page using the template system:
<div style="height:200px; overflow:auto;">{{product.file}}</div>
However, this shows a plain text with all HTML tags visible. How do I display such file correctly?
Upvotes: 1
Views: 110
Reputation: 37249
Assuming your are using jinja2
(if not, this can be updated), try passing your product.file
variable through the safe
function:
<div style="height:200px; overflow:auto;">{{product.file|safe}}</div>
This indicates that the value is 'safe' and can be rendered without escaping. See here for more (jinja2-related) information on HTML escaping.
Upvotes: 2