How to prevent Django's label_tag function from escaping the label?
<p>Example:</p>

<pre><code>&gt;&gt;&gt; example.label
&amp;#x3bb;&lt;sub&gt;blabla&lt;/sub&gt;
&gt;&gt;&gt; example.label_tag()
[...]&amp;amp;#x3bb;&amp;lt;blabla&amp;gt;[...]
</code></pre>

<p>Even calling <code>mark_safe(example.label)</code> before <code>label_tag()</code> does not prevent Django from escaping the HTML. How can I get <code>label_tag()</code> to return unescaped labels?</p>

<p>You have to mark the label as safe when you define the field.</p>

<pre><code>class MyForm(forms.Form):

    example = forms.Field(label=mark_safe('&amp;#x3bb;&lt;sub&gt;blabla&lt;/sub&gt;'))
</code></pre>

<p>Example:</p>

<pre><code>&gt;&gt;&gt; f = MyForm({'example': 'foo'})
&gt;&gt;&gt; str(f)
'&lt;tr&gt;&lt;th&gt;&lt;label for="id_example"&gt;&amp;#x3bb;&lt;sub&gt;blabla&lt;/sub&gt;:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_example" name="example" type="text" value="foo" /&gt;&lt;/td&gt;&lt;/tr&gt;'
</code></pre>

python django