简体   繁体   English

提取django多选表单选择

[英]Extract django multi-select form choice

I want to reload part of my page upon form submit.我想在提交表单时重新加载页面的一部分。 To do this i´d like to extract the selected fields from a Django multiselectfield.为此,我想从 Django 多选字段中提取选定的字段。 Now I´m kinda stuck because Django renders the form like this:现在我有点卡住了,因为 Django 呈现这样的表单:

在此处输入图片说明

Instead of select-Tags.而不是选择标签。 How can i extract which choices have been selected?如何提取已选择的选项? Or is there any way to return new information when the form has been selected without leaving the page?或者有什么方法可以在不离开页面的情况下选择表单时返回新信息?

You get the value in exactly the same way as for any other form field: via form.cleaned_data .您以与任何其他表单字段完全相同的方式获取值:通过form.cleaned_data In this case, form.cleaned_data['Messwerte'] .在这种情况下, form.cleaned_data['Messwerte']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM