Hi,
So I've got a expanding/collapsing tree that I'm keeping track of in session data.
I want to be able to render the tree in Django based upon the session data.
I am saving the state with something like:
request.session['treedata'][item_id] = state # (0 or 1)
In my template for rendering, I'm looping through the items and for each item I want to set the visibility of the object for example:
{% for item in itemlist %}
<div {% if request.session.treedata.<whatgoeshere?> %}style="display:none"{% endif %}>
Content of the subtree
</div>
{% endfor %}
So the is where I'm confused.
Can I specify:
request.session.treedata.(item.id)
or
request.session.treedata.(forloop.counter)
Or do I have to preprocess the item and the state into a new context variable?
Thanks!
James