Thursday, May 10, 2012

Does Django Template Support Nested Tags?

Hi all,

I'm wondering if Django template supports nested tags? Here is my
situation:

My Template:

<div id="body">
<ul class="acc" id="acc">
{% for module in modules %}
<li>
<h3>Automation Test Result for Test Suite: {{ module}}</h3>
<div class="acc-section">
<div class="acc-content">
{% for TC in TCs.{{forloop.parentloop.counter0}} %}
... ...

{% endfor %}
... ...
{% endfor %}

Here are the Lists I'm trying to pass into template:
- modules = ['module1', 'module2']
- TCs = [['TC1','TC2','TC3'],['Case1','Case2']]

But seems "{% for TC in TCs.{{forloop.parentloop.counter0}} %}" is not
working... That probably because a "forloop" is inside a "for" tag.
The error message is:
"Could not parse the remainder: '{{forloop.parentloop.counter}}' from
'TCs.{{forloop.parentloop.counter}}'"

Does anybody encounter the same problem with me? Could you help share
your idea to solve it? Thanks in advance.

Thanks,
Wally

--
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 from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate