【发布时间】:2018-10-20 14:59:24
【问题描述】:
我正在使用 django tables2 https://github.com/jieter/django-tables2 在模板中的表格中显示数据,该表格由 django-ckeditor https://github.com/django-ckeditor/django-ckeditor 创建。具体来说,我遇到的问题与 LinkColumn 表中的渲染有关:
class MyTable(tables.Table):
notes = tables.LinkColumn('notes_update', kwargs={"pk": Accessor("pk")},attrs={'th': {'id': 'thnotes'}, 'td': {'id': 'tdnotes'}})
数据显示在带有 html <p> <p/> 标签的表格中,由 ckeditor 创建。
据我所知,我需要使用{{ |safe }} 标签在模板中呈现,以便显示没有html <p> <p/> 标签的表格数据,但我不知道如何与django 一起实现这一点tables2 因为我的表格在我的模板中呈现如下:
{% render_table table %}
我试过用以下方法包围它,但没有成功:
{% autoescape off %}
{% render_table table %}
{% endautoescape %}
有没有人有任何想法可以帮助我在没有 html <p> <p/> 标签的情况下在我的表格中呈现 notes 数据?任何帮助将不胜感激!
【问题讨论】:
标签: django ckeditor4.x django-tables2