Tuesday, November 24, 2015

Escaping of help_text in form fields

Hi !

Just stumbled upon this issue, with django 1.8.6:


from django import forms
from django.template import Template, Context
class A(forms.Form):

    f
= forms.CharField(help_text=u'bli "blo" >', label="bla <")
 
Template("{{form.as_p}}").render(Context({"form": A()}))


# returns:

u
'<p><label for="id_f">bla &lt;:</label> <input id="id_f" name="f" type="text" /> <span class="helptext">bli "blo" ></span></p>'



The label is escaped, but not the help_text.

  • Is that a bug ?
  • or should I mark all my help_text as unsafe ?
I did not find anything relevant in the doc or with google.

Regards,

NotSqrt

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/839545e0-e583-4ed3-913d-f052117a56ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment