python-eel/Eel

How to pass argument to loop via jinja

Open

#485 aberto em 19 de mai. de 2021

Ver no GitHub
 (4 comments) (1 reaction) (0 assignees)Python (570 forks)batch import
help wanted

Métricas do repositório

Stars
 (5.980 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Describe the problem How do I pass argument b to a for loop to jinja template?

Code snippet(s) Example:

import eel

eel.init("web")

b = [1,2,3]

eel.start("templates/main.html",size =(350, 400), jinja_templates='templates')
<html>
    <label>
        <div>Example:</div>
        <select name="a">
            {% for a in b %}
                <option value="{{ a }}">{{ a }}</option>
            {% endfor %}
        </select>
      </label>
</html>

Guia do colaborador