I use django-mptt application in my project. This application allows users drag and drop tree nodes in admin page (DraggableMPTTAdmin
). Is it possible to make the same functionality in custom template (not in admin)?
P.S. I tried to use jsTree
plugin in frontend. This plugin allows the user drag and drop nodes of the tree but jsTree has heavy API. Also I dont know how to save new structure of new tree cause jsTree render strange attributes in html for tree nodes.
template:
<ul class="root">
{% recursetree nodes %}
<li>
{{ node.name }}
{% if not node.is_leaf_node %}
<ul class="children">
{{ children }}
</ul>
{% endif %}
</li>
{% endrecursetree %}
</ul>