我正在使用 authenticate() 手动对用户进行身份验证。使用管理界面,我可以看到用户没有“last_login”属性
调试回溯是:
Environment:
Request Method: GET
Request URL: https://localhost/login/
Django Version: 1.1.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'mobius.polls']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/pymodules/python2.6/django/contrib/auth/__init__.py" in login
55. user.last_login = datetime.datetime.now()
Exception Type: AttributeError at /login/
Exception Value: 'unicode' object has no attribute 'last_login'
我想不通,为什么会有这种差异。
任何形式的帮助将不胜感激。提前致谢!