I have this code,
            from django.contrib.auth import login
            user = User.objects.get(username =
login_form.cleaned_data['username'])
            login(request, user)
Which is giving me exception 'User' object has no attribute 'backend'

Traceback:
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File "E:\newforms\newf\views.py" in login
  31.             login(request, user)
File "C:\Python24\lib\site-packages\django\contrib\auth\__init__.py"
in login
  57.     request.session[BACKEND_SESSION_KEY] = user.backend

The login method from contrib.auth is
def login(request, user):
    """
    Persist a user id and a backend in the request. This way a user
doesn't
    have to reauthenticate on every request.
    """
    if user is None:
        user = request.user
    # TODO: It would be nice to support different login methods, like
signed cookies.
    user.last_login = datetime.datetime.now()
    user.save()
    request.session[SESSION_KEY] = user.id
    request.session[BACKEND_SESSION_KEY] = user.backend
    if hasattr(request, 'user'):
        request.user = user
and the user model obviously doesnot have a backend attribute, what am
I missing?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to