Reputation: 133
When I tried to render field label, that contains HTML tags, in the template, it was rendered to the simple text.
erotrotsity = forms.DecimalField(max_digits=7, decimal_places=3, label='Erot<sup>12</sup>', required=False, validators = [MinValueValidator(0)])
filter |safe and autoescape don't work
Upvotes: 0
Views: 62
Reputation: 308859
Use mark_safe()
:
from django.utils.safestring import mark_safe
erotrotsity = forms.DecimalField(max_digits=7, decimal_places=3, label=mark_safe('Erot<sup>12</sup>'), required=False, validators = [MinValueValidator(0)])
Upvotes: 1