我们如何为管理员change_form.html设置安全模板标签
我们如何为管理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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的问题比较模糊,很难给你提供帮助。
如果您想要以只读方式显示字段的内容,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
.