Malcolm Tredinnick wrote:
>> Or is there some other way to get at my 'align' list?
>
> Look at the {% cycle %} template tag. It's designed for precisely this
> purpose.
Thank you. But can someone show me how to make 'cycle' work?
from django.template import Context, Template
items = (0, 1, 2, 3, 4, 5)
mycycle = ("one", "two", "three")
t = Template("""
{% for item in items %}
{% cycle mycycle %}
{% endfor %}
""")
t.render(Context({ "items": items, "mycycle": mycycle }))
It works great if I replace 'mycycle' with hardcoded values, but as soon as I
try to supply it as a list from context it fails.
Any help?
Thanks,
Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---