jinja table template code example

Example 1: jinja table template


{% for item in items %}

{% endfor %}
{{item.date}} {{item.id}} {{item.position}} {{item.status}}

Example 2: jinja templates tables


{% for item in items %}

{% endfor %}
{{item.date}} {{item.id}} {{item.position}} {{item.status}}

Example 3: tables in jinja template

items = []
for i in range(1, 11):
    i = str(i)

    # dict == {}
    # you just don't have to quote the keys
    an_item = dict(date="2012-02-" + i, id=i, position="here", status="waiting")
    items.append(an_item)

# ... your code here ...

template.render(items=items)

Tags:

Misc Example