[Django]-How do I prevent Django from interpreting a block which contains curly quotes?

2👍

EDIT:
Your syntax is currently impossible with the current lexer / parser system.

Why? Basically the template system has a Lexer and a Parser. The Lexer takes the template string as input, and tokenizes it. The parser then takes the list of tokens in its constructor and parses them into a list of a bunch of Nodes for the compiled template. The template tags and filters only have access to the already constructed parser — you can’t access the initial lexer string. See the comments in django/templates/__init__.py

However, there is a solution. It’s not mine (see below), but its to basically use server side includes {% ssi some_file.html %} to include an extra file that has the literal text. Yes this is an ugly solution; but without a major rewrite of the templating system it will have to suffice.

Easy Way to Escape Django Template Variables

5👍

For the record, this is possible now with the template tag verbatim.

0👍

Leave a comment