Hi,

I just read chapter 12 in djangobook.com on authentication:
http://www.djangobook.com/en/beta/chapter12/

I am creating a new user in response to a registration form I've made,
doing something like this:
from django.contrib import auth
from django.contrib.auth.models import User
def createAccount(request):
      # extract information for PUT form request
      # ...
      newUser = User.objects.create_user(username_, email, pwd)
      newUser.save()
      auth.login(request, newUser)
      return HttpResponseRedirect('/userHome/')

But there is an exception with the login. Apparently the user doesn't
have a backend, as shown below.

Thoughts?

Thanks,
Ivan
www.kirigin.com

AttributeError at /createAccount/
'User' object has no attribute 'backend'
Request Method:         POST
Request URL:    http://127.0.0.1:8201/createAccount/
Exception Type:         AttributeError
Exception Value:        'User' object has no attribute 'backend'
Exception Location:     /usr/lib/python2.5/site-packages/django/contrib/
auth/__init__.py in login, line 53

/usr/lib/python2.5/site-packages/django/contrib/auth/__init__.py in
login

  46. Persist a user id and a backend in the request. This way a user
doesn't
  47. have to reauthenticate on every request.
  48. """
  49. if user is None:
  50. user = request.user
  51. # TODO: It would be nice to support different login methods,
like signed cookies.
  52. request.session[SESSION_KEY] = user.id

# THIS LINE
  53. request.session[BACKEND_SESSION_KEY] = user.backend ...

  54.
  55. def logout(request):
  56. """
  57. Remove the authenticated user's ID from the request.
  58. """
  59. try:


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