-1

trying a simple post from html ..

when i receive the request in django i just do print post request. (counts is not getting reflected in my output dunno y..)

        print "counterUpdate"
    print request.method
    print request.path
    print request.POST.get
    print "Expects data of counts in next line console print but it is empty"
    countValues=request.POST['counts'] # counts is not getting reflected in my output dunno y..
    updateType=request.POST['key']
    print countValues
    print updateType
    print "dddd1"
    for data in request.POST:
        print data
    print "Iteration Over"

out for the following:

counterUpdate
POST
/testapp/counterUpdate
<bound method QueryDict.get of <QueryDict: {u'counts': [u'100', u'100', u'', u''], u'key': [u'increase']}>>
Expects data of counts in next line console print but it is empty

increase
dddd1
counts
key
Iteration Over
Ragav
  • 942
  • 4
  • 19
  • 37

1 Answers1

3

You have to use getlist like:

request.POST.getlist('counts')

For more information: Django: using <select multiple> and POST

Community
  • 1
  • 1
Mordi
  • 691
  • 4
  • 5