other_quantity = forms.IntegerField(
required=False,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "in meter cube(m3)"}
),
label="<b>#</b> Quantity of Other Material to be Remove ",
)
我想在占位符中使用立方米符号。使用sup
标签尝试过,但是没有用。
答案 0 :(得分:1)
将superscript three HTML entity与Django的mark_safe
结合使用。
from django.utils.safestring import mark_safe
mark_safe("in m³")
您的情况应该是
from django.utils.safestring import mark_safe
...
other_quantity = forms.IntegerField(
required=False,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": mark_safe("in m³")}
),
label="<b>#</b> Quantity of Other Material to be Remove",
)