我们如何为管理员change_form.html设置安全模板标签

发布于 2024-09-04 05:53:13 字数 179 浏览 1 评论 0原文

我们如何为管理change_form.html设置安全模板标签, 我想显示 HTML 数据而不是管理表单的 TextArea 输入,

我有一个管理表单中排除的 django 字段,该字段包含 HTML 数据 - 这是动态生成的 - 你可以说报告数据,

我想显示该 HTML其他表单字段下方带有安全模板标签的数据。

how can we set safe template tag for admin change_form.html,
I want to display HTML data instead of TextArea Input for admin form,

I've a django field which is excluded in admin form, that field contains HTML data - which is dynamically generated - u can say reporting data,

I want to display that HTML data with safe templatetag below the other form fields.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不美如何 2024-09-11 05:53:13

你的问题比较模糊,很难给你提供帮助。

如果您想要以只读方式显示字段的内容,Django 1.2 有 只读字段。这将以文本形式显示该字段的内容,无论该字段不是只读的情况下显示的小部件如何。


编辑:啊,所以您有一个包含 HTML 的字段,并且您只想在管理页面的底部呈现其内容。

我认为在这种情况下唯一的办法是 覆盖django 管理模板。您可能必须覆盖 change_form.html

Your question is vague, so it is hard to help you.

If what you are trying to do is display the contents of a field in a read-only manner, Django 1.2 has read-only fields. That will display the contents of the field in text, regardless of the widget that would display for the field if it were not read-only.


Edit: Ah, so you have a field containing HTML and you just want to render its contents at the bottom of the Admin page.

I think the only recourse in this case is to override the django admin template. You will probably have to override change_form.html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文