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
The recommendation from the Jinja templating language works with the Django templating engine as well:
http://jinja.pocoo.org/docs/dev/templates/#escaping
The solution is this:
{{ '{' }}{{ id }}{{ '}' }}
Of course the other two answers work, but this is one is less verbose and more readable, in my opinion.