{{{
{# context is simple dict with one key {A=["1", "2", "3"]} #}
{% with example_defined_variable="123" %}
{% for item in A %}
Current item: {{ item }}
Current cycle item: {% cycle example_defined_variable %}
{% endfor %}
Visible page.
{% endwith %}
}}}
As you can see I render this template using django 4.0.1 and context
containing 1 key "**A**" with the value of **["1", "2", "3"]** (that is
the list of strings).
Then I try to print the items of the list along with predefined value (see
**with**-tag).
The result must be like:
{{{
Current item: 1
Current cycle item: 123
Current item: 2
Current cycle item: 123
Current item: 3
Current cycle item: 123
Visible page.
}}}
But instead Im getting:
No named cycles in template. 'example_defined_variable' is not defined
That means that cycle-tag do not recognize **example_defined_variable** as
defined variable, BUT
on the
[https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#cycle
documentation] page there is the note that you CAN use defined variables
in cycle-tag.
--
Ticket URL: <https://code.djangoproject.com/ticket/34467>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
Dublicate of
#34468
--
Ticket URL: <https://code.djangoproject.com/ticket/34467#comment:1>