﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20778	label_tag() escapes lazy labels twice	sephi@…	nobody	"If you use label_tag() on a field that uses a ugettext_lazy() string as a label, it gets escaped twice. That's easily reproducible with the following code:

models.py
{{{
# _ is ugettext_lazy
class MyModel(models.Model):
     name = models.CharField(_('My label'))
}}}

forms.py
{{{
class MyForm(forms.ModelForm):
     class Meta:
         model = MyModel
}}}

views.py
{{{
def my_view(request):
    myform = MyForm()
    assert False, myform['name'].label_tag()
}}}

If ""My label"" is translated as ""My 'label'"" (with single quotes around it), here's what you get:

`<label>My &amp;#39;label&amp;#39;</label>`

The expected behaviour would be to get the contents escaped but only once:

`<label>My &#39;label&#39;</label>`

That would then appear correctly in the template. Also if you use a simple string as a label in your model, it gets escaped correctly."	Bug	closed	Forms	1.5	Normal	needsinfo	label_tag		Unreviewed	0	0	0	0	0	0
