1👍
✅
You don’t have a key in the POST data called password
, because your password fields are password1
and password2
. So your dict get
is simply returning the default value, the empty string.
As Alasdair says in the comments, you should be using the form cleaned_data anyway. And since you can only get to that point if the form is valid, you know that the values exist, so you shouldn’t be using get
with a default: just use the standard dict access.
username = form.cleaned_data['username']
password = form.cleaned_data['password1']
Source:stackexchange.com