About 9,240,000 results
Open links in new tab
  1. Get lengths of a list in a jinja2 template - Stack Overflow

    How do I get the number of elements in a list in jinja2 template? For example, in Python:

  2. Set variable from another variable in Jinja - Stack Overflow

    I would like to know how can I set a variable with another variable in Jinja. I have got a submenu and I would like to show which link is active. I tried this: {% set active_link = {{recordtype}} -...

  3. jinja2 - How to output loop.counter in python jinja template?

    I want to be able to output the current loop iteration to my template. According to the docs, there is a loop.counter variable that I am trying to use: <ul> {% for user in userlist %} <l...

  4. How to pass selected, named arguments to Jinja2's include context?

    Using Django templating engine I can include another partial template while setting a custom context using named arguments, like this: {% include "list.html" with articles=articles_list1 only …

  5. How to use conditional if statements in Jinja 2? - Stack Overflow

    So I am new to Django and can use some help. I have used a for loop to display a list from my database. But I want to add an if statement such that, if the user input matches my database …

  6. jinja2 - How do you test if a variable is undefined? - Stack Overflow

    Oct 23, 2025 · From the Jinja2 template designer documentation: {% if variable is defined %} value of variable: {{ variable }} {% else %} variable is not defined {% endif %}

  7. Escape jinja2 syntax in a jinja2 template - Stack Overflow

    Aug 18, 2014 · I serve dynamic pages from Jinja2 templates in Flask. Now I am defining client-side templates in say, Jinja2-clone Nunjucks inside a script tag. Problem is, the client-side …

  8. How to increment a variable on a for loop in jinja template?

    Sep 24, 2011 · Jinja2 variables behaves differently from that of conventional scripting languages, you can't modify the variable in a for loop.Hence to bypass this behaviour you can use a …

  9. jinja2 - Import a Python module into a Jinja template? - Stack …

    Is it possible to import a Python module into a Jinja template so I can use its functions? For example, I have a format.py file that contains methods for formatting dates and times. In a …

  10. No module named jinja2, yet it's installed - Stack Overflow

    Apr 18, 2014 · Have you tried import sys; print sys.path to verify that your paths are fine? There's definitely something weird going on. Alternatively, pip uninstall jinja2 then pip install jinja2 …