Tree Widget for jQuery Tree Multiselect
This is a sample Django app, that provides jQuery Tree Multiselect widget.
Module is intendet to be used as a Django application. Standalone usage is very limited. See :ref:`Integration <integration>` for details.
Integration is very simple:
- Add this module to your :file:`setup.py` or requirements file:
# setupy.py: install_requires = [ .. tree_widget ..]
- Include this app to your applications in :file:`settings.py`:
INSTALLED_APPS = [ .. tree_widget.apps.tree .. ]
- You should import and use :class:`tree_widget.apps.tree.models.Tree` in your code.
- You can use :class:`tree_widget.apps.tree.forms.TreeMultipleChoiceField` form field in your forms:
from django improt forms from tree_widget.apps.tree.models import Tree from tree_widget.apps.tree.forms import TreeMultipleChoiceField from tree_widget.apps.tree.helpers import generate_struct_iterator class TreeForm(forms.Form): tree_field = TreeMultipleChoiceField(choices=generate_struct_iterator(Tree.objects.all()))
If used in template, this field should add all required statics and initialization to markup.
- there is a demo at http://rodeo01.thelirium.net/
- there is a local copy of jquery.js and jquery.tree-multiselect.js in :module:`tree_field.apps.tree` app.
- included widget, :class:`tree_field.apps.tree.forms.TreeMultipleChoiceSelect` will render script/css links before field, and initialization code after it: