I am trying to create a hierarchical form with nodes in django-treebeard.
I am using code from the docs, but it doesn't reset when I have another
root node, it should be on the left side if it has a depth of 1.
Also how would you make it expand when I click Products to expand products.
I organised my data into a tree so that displaying it in a hierarchical form
would be easier. Is there a better way to do this?
{% for item, info in annotated_list %}
{% if not item.is_leaf %}
{% if info.open %}
<ul><li>
{% else %}
</li><li>
{% endif %}
{{item}} - {{item.get_depth}}
{% for close in info.close %}
</li></ul>
{% endfor %}
{%endif%}{% endfor %}
- Products - 1
- Computers - 2
- Desktops - 3
- Laptops - 3
- Net books - 4
- Tablets - 3
- Tablet Accessories - 4
- Services - 1
- Replacement Parts - 2
- Hard drives - 3
- Monitors - 3
- LCD - 4
- Keyboards - 3
- Contact - 1
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.