问题
I would like to ask whether there is any field, like the one attached below, available in Django as a single object. If no, then how can we generate such a functionality of moving selected items to the right hand side.
Please guide, I shall be extremly thankful.
回答1:
You could make use of Django's FilteredSelectMultiple widget, as seen in the django-admin when you use filter_horizontal on a ManyToManyField:
Here's an example of doing it yourself with your own form: http://djangosnippets.org/snippets/2466/
回答2:
I'd do it in on the client side in JS, something like this: http://www.developergeekresources.com/examples/javascript/javascript-listbox_to_listbox.php
来源:https://stackoverflow.com/questions/12919328/multiple-left-to-right-selection-field