Your authentication has failed somehow and authenticate() has returned
an AnonymousUser object.

calling .save() on this raises the exception

(code = 
http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/models.py#L399
)


On 22 July 2010 23:33, Jeff <jeffreychar...@gmail.com> wrote:
> Hi,
>
> I get a NotImplementedException when I try to log a user in right
> after they register.
>
> Here is the source code:
>
> def create_account(request):
>    if request.method == 'POST':
>        form = UserCreationForm(request.POST)
>        if form.is_valid():
>            user = form.save()
>            authenticated_user = authenticate(username=user.username,
>                password=user.password)
>            login(request, authenticated_user)
>            return redirect(profile)
>    else:
>        form = UserCreationForm()
>    return render_to_response('registration/create_account.html', {
>        'form': form,
>    }, context_instance=RequestContext(request))
>
> And here is the stack trace:
>
> File "/home/jeff/.virtualenvs/osl_main-website/lib/python2.6/site-
> packages/django/core/handlers/base.py" in get_response
>  100.                     response = callback(request,
> *callback_args, **callback_kwargs)
> File "/home/jeff/projects/osl-main-website/wluopensource/accounts/
> views.py" in create_account
>  17.             login(request, authenticated_user)
> File "/home/jeff/.virtualenvs/osl_main-website/lib/python2.6/site-
> packages/django/contrib/auth/__init__.py" in login
>  69.     user.save()
> File "/home/jeff/.virtualenvs/osl_main-website/lib/python2.6/site-
> packages/django/contrib/auth/models.py" in save
>  427.         raise NotImplementedError
>
> Exception Type: NotImplementedError at /accounts/create_account/
> Exception Value:
>
> Thanks in advance for any help you can provide!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to