django admin 中的表单字段描述 [英] Form field description in django admin

查看:34
本文介绍了django admin 中的表单字段描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何像下一个示例那样在 django admin 中为表单字段添加提示?

How to add hint for the form field in django admin like in next example?

(此处:URL内容 说明在字段下方显示为灰色)

(here: URL and Content descriptions are shown with gray color under field)

推荐答案

在 models.py 中定义字段时:

When defining your fields in models.py:

myfield = models.CharField(max_length=100, help_text="This is the grey text")

将此链接加入书签:

https://docs.djangoproject.com/en/dev/ref/模型/字段/#help-text

我发现自己一直在引用它(不仅仅是为了 help_text,而是为了与模型字段有关的一切)!

I find myself referring to it all the time (not just for help_text, but for everything to do with model fields)!

这篇关于django admin 中的表单字段描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆