Python - Reading Checkboxes
I have a few checkboxes with common name and individual variables (ID). How can I in python read them as list? Now I'm using checkbox= request.POST['common_name'] It isn't work
Solution 1:
If you were using WebOB, request.POST.getall('common_name') would give you a list of all the POST variables with the name 'common_name'. See the WebOB docs for more.
But you aren't - you're using Django. See the QueryDict docs for several ways to do this - request.POST.getlist('common_name')
is one way to do it.
Solution 2:
checkbox = request.POST.getlist("common_name")
Post a Comment for "Python - Reading Checkboxes"