How can display the label of non-editable fields in django template

*爱你&永不变心* 提交于 2019-12-13 02:54:18

问题


I have this field in my model:

created_date = models.DateTimeField(null=True, blank=True,editable=False, verbose_name=_("Something to show... "))

In accordance with this document ,I show the value of this field by:

form.instance.created_date

I see these links: 1,2,3,4 and this docucment of django. But none of them talk about showing the label (Or verbos_name) of non-editable fields in template.

Also I test these possible modes:

1. form.instance.created_date.label_tag
2. form.instance.created_date.label
3. form.instance.created_date.name
4. form.instance.created_date.verbos_name
...

So ,how can I do this? Is it possible to help me?

来源:https://stackoverflow.com/questions/56465295/how-can-display-the-label-of-non-editable-fields-in-django-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!