I have a drop down box on my Django form that contains the ® HTML entity. Is there an easy way to get Django to mark it as safe?
This doesn’t work:
{{ form.myoptions.label_tag }}
{{ form.myoptions|safe }}
Edit:
I should mention that the drop down box is generated from a ForeignKey field.
You’re right – it doesn’t work… I suppose the easiest way is to mark it safe from python.
According to the source it looks like you can either define a
ModelChoiceField.choicesmanually or write a new field and overridelabel_from_instance.I think I prefer constructing the choices myself so that any other magical
ModelFormfield -> form fieldconversion isn’t overwritten.