Reputation: 10580
Setup:
Issue:
How to know at any given recursion level the depth level at which currently I am?
Example:
This is the HTML:
<ul>
<li>
0
<ul>
<li>1</li>
<li>1</li>
</ul>
</li>
<li>0</li>
</ul>
0,1 are the children's depth level that I want to get at any given time.
Upvotes: 2
Views: 395
Reputation: 130
You can use the template variable node.level
and it will give you the indentation level.
You can read more about it at:
http://django-mptt.readthedocs.org/en/latest/technical_details.html?highlight=level#level
Upvotes: 3