Multiple left to right selection field

ぐ巨炮叔叔 提交于 2019-12-23 01:54:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!