You need to obtain the user by calling auth.authenticate, this sets the backend to the user.
auth.login expects an user created this way and stores the backend in the session, if you want to avoid the auth.authenticate you will have to set a backend in the user yourself. On Thu, Sep 23, 2010 at 3:38 PM, Yo-Yo Ma <[email protected]> wrote: > I think I've found a bug in auth.login. > > > user = User.objects.get(username=request.POST.get('username', '')) > if user.check_password(request.POST.get('password', '')): > login(request, user) > > This raises the following exception: > > Exception: 'User' object has no attribute 'backend' > > Location: C:\Python26\Lib\site-packages\django-trunk\django\contrib > \auth\__init__.py in login, line 80 > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<django-developers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
