Django django-admin-tools 仪表板模块 - HTML 内容
这个 django-admin-tools 说我们可以在子元素中使用 HTML 或文本。但是它却把我们给的 HTML 标签进行了转义,导致所有的标签都像原样显示出来,而没有被正常渲染。
self.children.append(modules.DashboardModule(
title = 'Example',
children = ['<b>bold example</b>',],
))
2 个回答
0
根据文档的内容:
pre_content
Text or HTML content to display above the module content. Default value: None.
content
The module text or HTML content. Default value: None.
post_content
Text or HTML content to display under the module content. Default value: None.
在整个文档中,没有任何地方提到 children
属性可以包含 HTML。
1
编辑模板
admin_tools/dashboard/module.html
然后添加
{% autoescape off %} {% endautoescape %}