tags:

views:

30

answers:

1

I m working on django view.I m posting a form which has a param name 'service'.Service is checkbox so it will have mulitple values.When i am getting the values of service in my code it is giving me only one value not the array.Here is my sample code

 {% for ser in allService %}
 <td  >         
     <input type="checkbox" name="service" value="{{ ser.id }}" >{{ ser.description }}
 </td>
 {% endfor %}

def update(request):
     service=request.POST.get('service')
     print service

how can i get a array.In java we getParameterValues('service')

A: 

The POST attribute is a QueryDict, so you can do this:

service = request.POST.getlist('service')
Yuval A
@yuval Athanks for the answer.Can you give me link for this documentation
ha22109
Link already within
Yuval A