Hi Everyone,
    I'm trying out django and it's been really easy getting the auth
library up and running. I hit an issue where I want to login a new
user right after they've registered and take them to their profile
page.

I tried calling the auth.login method but I got an error saying that
the new_user object doesn't have the attribute error. I guess this is
because the session and auth middlewares didn't get to alter new_user.

Does django provide a quick way of resolving this?

Thanks a lot,
   Cristian

My code:

def register(request):
    form = UserCreationForm()
    if request.method == 'POST':
        data = request.POST.copy()
        errors = form.get_validation_errors(data)
        if not errors:
            new_user = form.save(data)
            auth.login(request, new_user)
            return HttpResponseRedirect('/accounts/profile')
    else:
        data, errors = {}, {}
    return render_to_response('register.html',
                              {'form': forms.FormWrapper(form, data,
errors)})


My Error:

AttributeError at /register/
'User' object has no attribute 'backend'
Request Method:         POST
Exception Type:         AttributeError
Exception Value:        'User' object has no attribute 'backend'
Exception Location:     C:\Python25\lib\site-packages\django\contrib\auth
\__init__.py in login, line 55


--~--~---------~--~----~------------~-------~--~----~
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