Easy Way to Escape Django Template Variables

后端 未结 6 895
礼貌的吻别
礼貌的吻别 2021-02-04 06:28

For a new project we\'re writing documentation about the Django template system. We use Django for the documentation project itself too, so Django picks up all our exam

6条回答
  •  别跟我提以往
    2021-02-04 06:36

    A possible solution is to write the templates as usual (with {{ x }}), but save them as .txt (or any other extension you want). Write a script the runs over these files, and automatically creates the .html for you, by doing the reverse of templatetag (replacing {{ with {% templatetag openvariable %}etc). Make sure the code runs after you update the templates.

提交回复
热议问题