我有一个非常简单的登录表单:
class LoginForm(forms.Form):
username = forms.CharField(max_length=100,required = True)
password = forms.CharField(widget = forms.PasswordInput(),max_length=100,required = True)
我在视图中按照以下方式使用它:
def login(request):
msg = []
form = LoginForm()
if request.method == 'POST':
form = LoginForm(request.POST)
if form.is_valid():
username = form.cleaned_data['username']
password = form.cleaned_data['password']
user = authenticate(username = username, password = password)
我收到错误太多值无法解压缩。我究竟做错了什么 ?如果您需要更多信息,请发表评论。