How to escape {{ or }} in django template?

前端 未结 10 1908
慢半拍i
慢半拍i 2020-12-01 04:17

Django treats {{ var }} as some variable in its template. How can I escape {{ var }} or {{ or }} such that django does no

10条回答
  •  春和景丽
    2020-12-01 04:45

    it can be solved by avoing adjacent angular backets, if its inside javascript code then you can write

    '{'+'{address.'+key+'}}'
    

    I used this to print jinja variables into another template,using javascript.

提交回复
热议问题