Django CustomToMany字段的自定义小部件 [英] Django Custom Widget For ManyToMany field

查看:104
本文介绍了Django CustomToMany字段的自定义小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道显示2个选择框的小部件。一个显示模型中所有对象的列表,另一个显示已选择的对象。然后,用户可以从第一个列表中选择一个对象,单击>>按钮将其移动到选定列表。然后,当保存表单时,所选列表中的对象将保存在manytomany字段中。



感谢

解决方案

django.contrib.admin.widgets.FilteredSelectMultiple


Does anyone know of a widget that displays 2 select boxes. One shows a list of all object in a model and the other shows the objects which have been selected. The user can then select an object from the first list, click an >> button which moves it to the 'selected' list. Then when the form is saved the objects in the selected list are saved in the manytomany field.

Thanks

解决方案

django.contrib.admin.widgets.FilteredSelectMultiple

这篇关于Django CustomToMany字段的自定义小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆