Bonjour, j'ai crée une page d'identification mais lorsque que je me connecte un message d'erreur s'affiche ne m'aidant pas beaucoup :

MultiValueDictKeyError at /connexion/connexion/
"'username'"
Request Method: GET
Request URL: http://localhost:8000/connexion/connexion/
Django Version: 1.6.1
Exception Type: MultiValueDictKeyError
Exception Value: "'username'"
Exception Location: /usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py in __getitem__, line 301
Python Executable: /usr/bin/python

Ma vue:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#-*- coding: utf-8 -*-
from django.shortcuts import render
from connexion.forms import ConnexionForm
from django.contrib.auth import authenticate
from django.http import HttpResponse
from connexion.models import utilisateurs
 
def login(request):
    username = request.POST['username']
    assword = request.POST['password']
    user = authenticate(username=username password=password)
 
    if user is not None:
        if user.is_active:
            login(request, user)
            print("Connecté !")
 
 
        else:
            print("mdp valide, mais compte indisponible ")
    else:
        print("id et mdp non valide")

Ma page html:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{% extends "base.html" %}
{% block title %}Test page connexion{% endblock %}
 
{% block content %}
<h3>Connexion: </h3>
 
{% if form.errors %}<p class="error">Erreur mot de passe</p>{% endif %}
 
	<form action="" method="POST">
		<table align="center">
			<tr>
				<td><label for="username">User name:</label></td>
				<td><input type="text" name="username" id="username"></td>
			</tr>
			<tr>
				<td><label for="password">Password:</label></td>
				<td><input type="password" name="password" id="password"></td>
			</tr>
			<tr>
				<td><input type="submit" value="Connexion" /></td>
				<td><input type="reset" value="Reinitialiser"></td>
			</tr>
		</table>
	</form>
 
 
{% if envoi %}Connecté !{% endif %}
{% endblock %}

Mon URL:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
from django.conf.urls import patterns, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib.auth.views import login
 
urlpatterns = patterns('connexion.views',
    url(r'^connexion/$', 'login'), #Vue connexion
)
Help me please !