title: Display recursive content on Jinja
body: <p>I want to display in a webpage the contents of a dictionary. The dictionary structure is recursive. I can not make it work though like that. Instead, I have to "manually unfold" the recursion. Probably, I have not understood correctly the documentation.</p>
  
  <p>Code without the use of recursion (and it works).</p>
  
  <pre><code>{% extends "base.html" %}
  {% block body %}
  &lt;form action=""&gt;
  {% for account in account_list['account_list'] %}
  &lt;ul&gt;
      &lt;input type="checkbox" id="{{ account['id'] }}" value="{{ account['name'] }}" type="{{ account['type'] }}"&gt; {{ account['name'] }} &lt;br&gt;
      {% for key, value in account.items() %}
          {% if value is not string %}
              {% for acc in value %}
                  {% if acc is mapping %}
                      &lt;ul&gt; 
                          &lt;input type="checkbox" id="{{ acc['id'] }}" value="{{ acc['name'] }}" type="{{ acc['type'] }}"&gt; {{ acc['name'] }} &lt;br&gt;
                          {% for ke, va in acc.items() %}
                              {% if va is not string %}
                                  {% for ac in va %}
                                      {% if ac is mapping %}
                                          &lt;ul&gt;
                                              &lt;input type="checkbox" id="{{ ac['id'] }}" value="{{ ac['name'] }}" type="{{ ac['type'] }}"&gt; {{ ac['name'] }} &lt;br&gt;
                                          &lt;/ul&gt;
                                      {% endif %}
                                  {% endfor %}
                              {% endif %}
                          {% endfor %}
                      &lt;/ul&gt;
                  {% endif %}
              {% endfor %}
          {% endif %}
      {% endfor %}
  &lt;/ul&gt;
  {% endfor %}
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Code with recursion but it does not work.</p>
  
  <pre><code>{% extends "base.html" %}
  {% block body %}
  &lt;form action=""&gt;
  {% for account in account_list['account_list'] %}
  &lt;ul&gt;
      &lt;input type="checkbox" id="{{ account['id'] }}" value="{{ account['name'] }}" type="{{ account['type'] }}"&gt; {{ account['name'] }} &lt;br&gt;
      {% for key, value in account.items() recursive %}
          {% if value is not string %}
              {% for acc in value %}
                  {% if acc is mapping %}
                      &lt;ul&gt; 
                          &lt;input type="checkbox" id="{{ acc['id'] }}" value="{{ acc['name'] }}" type="{{ acc['type'] }}"&gt; {{ acc['name'] }} &lt;br&gt;
                          {% loop(acc.items()) %}
                      &lt;/ul&gt;
                  {% endif %}
              {% endfor %}
          {% endif %}
      {% endfor %}
  &lt;/ul&gt;
  {% endfor %}
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Relevant documentation: <a href="http://jinja.pocoo.org/docs/templates/" rel="nofollow">http://jinja.pocoo.org/docs/templates/</a> (look for the recursive)</p>