I have this view and I have a bug why? def index(request): # jezeli formularz coś wysłał if request.method == 'POST': form_r = UserCreationForm(request.POST) username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password)
# jezeli uzytkownik istnieje if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('profile') else: # Return a 'disabled account' error message ... else: # Return an 'invalid login' error message. return HttpResponseRedirect('invalid_login') if form_r.is_valid(): form_r.save() info="Zarejestrowałeś się!" return render_to_response('ownsite/register_success.html', {info:'info'}) else: return HttpResponseRedirect('/') # tworze formularze args = {} args.update(csrf(request)) args['form_l'] = AuthenticationForm() args['form_r']= UserCreationForm() return render_to_response('index.html', args) A bug MultiValueDictKeyError at / > > "'password'" > > Request Method: POST Request URL: http://127.0.0.1:8000/ Django Version: > 1.8.4 Exception Type: MultiValueDictKeyError Exception Value: > > "'password'" > > Exception Location: > C:\Python34\lib\site-packages\django\utils\datastructures.py > in __getitem__, line 322 Python Executable: C:\Python34\python.exe Python > Version: 3.4.3 Python Path: > > ['C:\\Python34\\ownsite', > 'C:\\WINDOWS\\SYSTEM32\\python34.zip', > 'C:\\Python34\\DLLs', > 'C:\\Python34\\lib', > 'C:\\Python34', > 'C:\\Python34\\lib\\site-packages'] > > Server time: Czw, 17 Gru 2015 22:07:11 +0100 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/13733cbd-af07-48ec-8a2c-24cde0c8d432%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.