Create a python module called templatetags.
Create a new file called verbose_name.py.
from django import template register = () @register.simple_tag def get_verbose_field_name(instance, field_name): """ Returns verbose_name for a field. """ return instance._meta.get_field(field_name).verbose_name.title()
Introduces customized tags on the template page.
{% load verbose_names %}
{% get_verbose_field_name instance field %}
Additional knowledge:Difference between label and verbose name of form in django
captcha = CaptchaField(label = u'captcha')
captcha = CaptchaField(verbose_name = u'captcha')
label is the field that will be displayed if it is in a form.
verbose_name is not displayed in the form, it's just a description.
Above this Django template to get the field's verbose_name example is all I have to share with you, I hope to be able to give you a reference, and I hope you support me more.