oTree Forum >

Formfield labels are escaped

#1 by somas

https://otree.readthedocs.io/en/latest/misc/otreelite.html#templates indicates that the |mark_safe filter has been deprecated because the templating engine no longer escapes strings, so it's redundant.

Despite that, when accessing a field label like

{{ for field in form }}
{{ endfor }}

that label will be escaped (i.e, <i>test</i> will become &lt;i&gt;test&lt;/i&gt;). Is there a way to prevent that?

#2 by somas

Inspecting otree's sourcecode it seems that accessing the field like


works for this specific usecase, but I wonder if the former is the expected behavior, if .text is supported, and/or if this should be documented

Write a reply

Set forum username