django-multiselectfield
django-multiselectfield copied to clipboard
Sortable Multichoice field
I have modified the default form widget to enable sorting of data which is added into our DB. This PR makes this behavior default since I am not sure if there is any disadvantage of doing that.
This adds an extra dependency of JQuery UI library: https://jqueryui.com/ Possibly, any other simple JS library can replace the JQuery UI module.
Behavior
- All list of items are sortable. Since there is no change in how the DB stuff is handled, only sorting of the selected items will be saved.
- When the form is reloaded, all selected items show on top in sorted order, and unselected items go at bottom(in the same order they are defined).
- When sorting is changed, the form is marked as dirty and saved again. This is a change from the current behavior.
PS: I am unsure of my sorting technique by overriding optgroups function. Any advise is welcome.
Hi, could you update from master?