When more than one category needs to be selected in a form, you can use the
TreeNodeMultipleChoiceField multiple selection field that is provided by
django-mptt. However, multiple selection fields are not very user-friendly from GUI point of view as the user needs to scroll and hold the control keys while clicking in order to make multiple choices. That's really awful. A much better way will be to provide a checkbox list to choose the categories. In this recipe, we will create a field that allows you to show the indented checkboxes in the form.
We will start with the
movies app that we defined in the previous recipes and also the
utils app that you should have in your project. ...