Revision history [back]
Do you have django.contrib.auth
properly enabled?
You'll need the following in the MIDDLEWARE_CLASSES
setting (among others):
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
And in the INSTALLED_APPS
:
'django.contrib.auth',
'django.contrib.sessions',
Value of the visitor
comes from request.user
, which is installed onto the request
object by the auth
system. If the user is authenticated, then instance of real user object will be added, otherwise - an instance of AnonymousUser
. In your case you are getting None
.