Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

250
Views
How to have Django *not* parse "{{variable}}" when using Jsrender?

I am building a Django template which will use jsrender in order to build out dynamic Javascript templates for html code.

However, I find that when I put a Jsrender template in my code, Django flips out because Django parses anything between {{ and }} as a variable, and Jsrender uses this for its own variables. For instance, a template in Jsrender might look like:

    <script id="headerTemplate" type="text/x-jsrender">
        <h1>{{:label}}</h1>
    </script>

Django sees {{:label}} and tries to parse it, which leads to an error.

Is there a Django block I can invoke which would make Django not parse any text within it? Or otherwise to escape a { character?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can choose alternative delimiters in JsRender, so as to avoid the conflict with Django delimiters.

https://www.jsviews.com/#settings/delimiters

For example:

$.views.settings.delimiters("<%", "%>");

will change the tag syntax to <%...%>.

about 4 years ago · Juan Pablo Isaza Report

0

You can turn on the {% verbatim %} … {% endverbatim %} template tag [Django-doc]:

{% verbatim %}
    <script id="headerTemplate" type="text/x-jsrender">
        <h1>{{:label}}</h1>
    </script>
{% endverbatim %}

This will thus render the double curly brackets, not interpret these.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!