Hello everyone!

I would like to achieve a result like the following one.

{% extends "base.html" %}
> {% block body %}
>
> Something: 
> {% for k, v in a.items() recursive %}
>     {% if v is not string %}
>         {% for ke, va in v.items() %}
>             {% if va is mapping %}
>                 {{ loop(va.items()) }}
>             {% else %}
>                 {{ va }}
>             {% endif %}
>         {% endfor %}
>     {% else %}
>         {{ v }}
>     {% endif %}
> {% endfor %}
>
> {% endblock %}
>

In other words, is it possible between a recursive call of a loop to have 
another loop? If I try it, I get an error:

> TypeError: Tried to call non recursive loop. Maybe you forgot the 
> 'recursive' modifier.
>

On the server side, the code that I used to test it is:

> from flask import Flask
> from flask import render_template
> from flask import request
>
>
> app = Flask(__name__, template_folder='../templates')
>
> @app.route('/')
> def homepage():
>     d = dict()
>     d['a'] = dict()
>     d['a']['b'] = dict()
>     d['a']['b']['c'] = dict()
>     d['a']['b']['c']['d'] = dict()
>     d['b'] = 'a'
>     d['c'] = 'b'
>     d['a']['b']['c']['d']['e'] = dict()
>     d['a']['b']['c']['d']['e']['f'] = 'g'
>
>     return render_template('testme.html', a=d)
>
> if __name__ == "__main__":
>     app.run(debug=True)
>
 
Kind regards,
Dimitris

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pocoo-libs/-/K7TPBnR5BiUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to