本文介绍了Django:使用< select multiple>和POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的模板中使用这样的东西

I'm using something like this in my template

<select multiple="multiple"  name="services" id="services" size="5">
    {% for service in services %}
        <option value="{{service.id}}">{{service}}</option>
    {% endfor %}
</select>

当我在Firebug或Django调试中查看POST数据时,我看到它只发送一个值。我做错了什么或误解了一个概念?

When I view the POST data in Firebug or the Django debug, I see it only sends one value. Am I doing something wrong or misunderstanding a concept?

推荐答案

request.POST.getlist('services')

这篇关于Django:使用&lt; select multiple&gt;和POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 23:17