15
I'm getting a KeyError for 'password' when I try to submit my form.
trace:
Request Method: POST
Request URL: http://localhost:8000/register/
Django Version: 1.2.1
Python Version: 2.7.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'djangoproject1.authentication']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
100. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Users\jec23\My Java Projects\djangoproject1\src\djangoproject1\authentication\views.py" in register
20. if rf.is_valid() and pf.is_valid():
File "C:\Python27\lib\site-packages\django\forms\forms.py" in is_valid
121. return self.is_bound and not bool(self.errors)
File "C:\Python27\lib\site-packages\django\forms\forms.py" in _get_errors
112. self.full_clean()
File "C:\Python27\lib\site-packages\django\forms\forms.py" in full_clean
268. self._clean_form()
File "C:\Python27\lib\site-packages\django\forms\forms.py" in _clean_form
296. self.cleaned_data = self.clean()
File "C:\Users\jec23\My Java Projects\djangoproject1\src\djangoproject1\authentication\forms.py" in clean
16. if self.cleaned_data['cpassword']!=self.cleaned_data['password']:
Exception Type: KeyError at /register/
Exception Value: 'password'
views:
def register(request):
if request.method == 'POST':
rf = forms.RegisterForm(request.POST)
pf = forms.ProfileForm(request.POST)
if rf.is_valid() and pf.is_valid():
newuser = User(username=rf.cleaned_data['username'],email=rf.cleaned_data['email'])
newuser.set_password(rf.cleaned_data['passwor