django auth : strange error with authenticate()

Posted by Rohit on Stack Overflow See other posts from Stack Overflow or by Rohit
Published on 2010-06-08T08:26:27Z Indexed on 2010/06/08 8:42 UTC
Read the original article Hit count: 500

I am using authenticate() to authenticating users manually. Using admin interface I can see that there is no 'last_login' attribute for Users

Debug traceback is :

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'

I cant figure out, why is there this discrepancy.
Any kind of help would be appreciated. Thanks in advance!

© Stack Overflow or respective owner

Related posts about python

Related posts about django