In my template I’m writing:
<div class="content video">{{ each.text }}</div>
And I’m getting:
<iframe width="300" height="200" src="http://www.youtube.com/embed/1C1HLH-hOZU" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
I want that text to be the part of the mark up,not as text.What say?
Do you mean the output of
each.textis escaped and you see the text in your browser rather than the rendered markup?This is because Django’s template engine autoescapes output by default for security reasons. You might want to use the builtin
safefilter like this:Or another way is to use
mark_safein your view.