错误发生在这里:
if request.method == 'POST':
form = RegisterForm(request.POST)
if form.is_valid():
clean = form.cleaned_data
username = clean['username']
email = clean['email']
password = clean['password']
new_user = User.objects.create_user(username, email, password)
new_user.save()
new_account = Account(user=new_user, email=email)
new_account.save()
在线username = clean['username']
上。我已经能够在其他地方成功使用这条确切的线路而没有问题。为什么现在是个问题?