Hi - first time with Jinja, and not very clever I am sure.

I need to pass something like "1,2,3" to the jquery sparkline plugin.

I have a list = [1,2,3].

First I tried list comprehension:

 {{ ', '.join([str(x) for x in list]) }}


But jinja does not support this. Then I tried enumerate:

{% for p, i in enumerate(list) %}
{% if p == 0 %}
{{ i }}
{% else %}
,{{ i }}
{% endif %}
{% endfor %}


 But jinja does not like enumerate either? There must be a smart way of 
doing this?

Thanks in advance.
 

 

-- 
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/-/h13fIYXSxroJ.
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