Django ckeditor和Django tables2安全渲染

Django ckeditor和Django tables2安全渲染,django,ckeditor4.x,django-tables2,Django,Ckeditor4.x,Django Tables2,我正在使用django tables2在由django ckeditor创建的模板中的表中显示数据。具体而言,我遇到的问题与LinkColumn表中的呈现有关: class MyTable(tables.Table): notes = tables.LinkColumn('notes_update', kwargs={"pk": Accessor("pk")},attrs={'th': {'id': 'thnotes'}, 'td': {'id': 'tdnotes'}}) 数据显示在

我正在使用django tables2在由django ckeditor创建的模板中的表中显示数据。具体而言,我遇到的问题与LinkColumn表中的呈现有关:

class MyTable(tables.Table):
    notes = tables.LinkColumn('notes_update', kwargs={"pk": Accessor("pk")},attrs={'th': {'id': 'thnotes'}, 'td': {'id': 'tdnotes'}})
数据显示在表格中,带有由ckeditor创建的html

标记

根据我所能收集到的信息,我需要使用
{{safe}}
标记在模板中呈现,以便在没有html

标记的情况下显示表数据,但我不知道如何结合django tables2实现这一点,因为我的表在我的模板中呈现如下:

{% render_table table %}
我试图围绕这一点,但没有成功:

  {% autoescape off %}
  {% render_table table %}
  {% endautoescape %}

有没有人能帮我在没有html

标记的情况下呈现表中的
注释
数据?任何帮助都将不胜感激

我认为最直接的方法是使用:

类MyTable(tables.Table):
notes=tables.TemplateColumn(
模板代码=“”“”,
attrs={'th':{'id':'thnotes'},'td':{'id':'tdnotes'}
)

这将为您提供一个熟悉的模板来控制表格单元格的内容。

绝妙的解决方案!非常感谢你。pk=record.pk%}之后的}>之间缺少一个双引号。也许你可以为未来的访问者编辑你的答案?谢谢,补充了缺少的报价。
class MyTable(tables.Table):
    notes = tables.TemplateColumn(
        template_code='''<a href="{% url 'notes_update' pk=record.pk %}">{{ record.notes |safe }}</a>''',
        attrs={'th': {'id': 'thnotes'}, 'td': {'id': 'tdnotes'}}
    )