﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17191	QueryDict appears incorrect on POST.	otto@…	nobody	"The following is test code stripped to bare essentials.  When run with
"">python manage.py runserver"".
The values entered in the form at the T1 and T2 fields are ""t1-value""
and ""t2-value"" respectively.

The following error is produced:

{{{
MultiValueDictKeyError at /test_view/
""Key 't1' not found in <QueryDict: {u'Bname': [u'Bval\\r\\nt1=t1-value\\r\\nt2=t2-value\\r\\n']}>""
}}}

Code that produces this is:

{{{
##### BEGIN CODE #####
#views_test.py#
from django.http import HttpResponse
from django import template     
from django.views.decorators.csrf import csrf_exempt

data = \
""""""
<!DOCTYPE html PUBLIC ""-//W3C//DTD HTML 4.01//EN"" ""http://www.w3.org/TR/html4/strict.dtd"">
<html>
  <head><title>Test</title></head>
  <body>
    <form enctype=""text/plain"" method=""POST"" action=""/test_view/"">
        <button value=""Bval"" name=""Bname"">TEST</button><br><br>
        T1 &nbsp;<input name=""t1"" value=""""/><br>
        T2 &nbsp;<input name=""t2"" value=""""/><br><br>
    </form>
  </body>
</html>
""""""

@csrf_exempt 
def test(request):    
    return HttpResponse(data)

@csrf_exempt 
def test_view(request):
    t1 = request.POST['t1']
    t2 = request.POST['t2']
    return HttpResponse(""Returns %s and %s OK with %s "" % (t1,t2,""POST""))
##### END CODE #####
}}}

Moving the button and input fields around shows that the 
""!QueryDict"" key is always the
first field name in the form ""Bname"" above.  Moving the button to follow the entry fields gets following error:

{{{
MultiValueDictKeyError at /test_view/
""Key 't2' not found in <QueryDict: {u't1': [u't1-value\\r\\nt2=t2-value\\r\\nBname=Bval\\r\\n']}>""
}}}

Changing POST to GET throughout makes form work.
"	Bug	closed	Uncategorized	1.3	Normal	invalid	QueryDict, POST, MultiValueDictKeyError		Unreviewed	0	0	0	0	0	0
