It seems you can also say
{{item.list.0}} = {{item.list.1}}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe fro
First of all, do you need a template tag for this? Can't you say
{% for item in mylist %}
{{item|slice:"0"}} = {{item|slice:"1"}}
{% endfor %}
If you want to create a for-loop-like template tag, you need some
additional machinery. It's best to use class ForNode and def do_for()
from defaulttags
I wrote a custom tag to loop through a list of tuples and give a
seperate variable for each key and value. I want it to do the
following.
list=[('one',1),('two',2)]
for a,b in list:
return a,b #return these to context variables.
{{a}} = {{b}}
Right now the custom tag is very bare, it doesn't
3 matches
Mail list logo