[Answer]-MultiValueDictKeyError at /verification/

1👍

When a HTML form gets serialized, it is the name attributes of the inputs that are used as keys for their values, not their ids.

For example, <input id="an_input" name="foo" value="bar"> will be serialized to foo=bar which Django will deserialize, more or less, to a Python dict, here: {'foo': 'var'}.

All you need to do is:

<form class="form-signin" action="{% url "verification" %}" method="POST">
  <input type="text" class="form-control" id="username" name="username" placeholder="Username" required autofocus>
  <input type="password" class="form-control" id="password" name="password" placeholder="Password" required>
  <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
👤aumo

Leave a comment