Django - Store unescaped html in model

前端 未结 1 1743
梦谈多话
梦谈多话 2021-02-14 03:56

I am trying to store raw, unescaped HTML inside one of my Django models for display on my home page. However, when I store it in a TextField it gets escaped, and ends up just be

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-14 04:58

    You can use the safe filter to present unescaped text, or escape filter to present escaped text. You can also use autoescape tag to set a block. ({% autoescape on %} or {% autoescape off %})

    0 讨论(0)
提交回复
热议问题