MultiValueDictKeyError in Django

Sure, you are not passing username as a GET parameter while getting the http://127.0.0.1:8000/StartPage/ page.

Try this and observe username printed: http://127.0.0.1:8000/StartPage?username=test.

Use get() and avoid MultiValueDictKeyError errors:

request.GET.get('username', '') 

See also:


Make sure the request you are getting doesn't contains disabled. If the field which you are getting contains disabled. It will give this error. So, in order to solve this make sure your don't have a disabled word in your field. e.g

 <input  name="numberid" disabled class="form-control"  value="{{p.id}}" type="text"></div>

In my case, the disabled keyword was causing this error.

Tags:

Python

Django