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>
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?
From stackoverflow
-
request.POST.getlist('services')neoice : Jackpot! I think I _did_ need to change services to services[], but getlist r0xors for this. I thought I'd scoured the Django docs but apparently, I was wrong.bobince : You don't need the []. That's a convention limited to PHP.
0 comments:
Post a Comment