我有一个简单的登录界面:
def logowanie(request):
if request.method == 'POST':
user = authenticate(
username=request.POST.get('id_username', '').strip(),
password= request.POST.get('id_password', ''),
)
if user is None:
messages.error(request, u'Invalid credentblog.ials')
else:
if user.is_active:
login(request, user)
return HttpResponseRedirect(request.GET.get('next', '/'))
else:
messages.error(request, u'User is not active.')
return render_to_response('registration/login.html', locals(),
context_instance=RequestContext(request))
当我尝试进入登录页面时,出现错误:
TypeError: login() missing 1 required positional argument: 'user'
我做错了什么?