How to put braces in django templates?

前端 未结 3 924
终归单人心
终归单人心 2020-12-10 01:20

I need to produce an id surrounded by braces ( for example \"{1234}\" ). With the django template language, braces are also used to start a variable substitution, so I have

3条回答
  •  北海茫月
    2020-12-10 02:03

    I think your answer can be found here:

    http://docs.djangoproject.com/en/dev/ref/templates/builtins/#templatetag

    In short, you want to use {% templatetag openbrace %} and {% templatetag closebrace %}.

    Edit: Django now also includes this functionality out of the box:

    {% verbatim %} {{ blah blah }} {% endverbatim %}
    

提交回复
热议问题