So I did get an email from shwetanka <shweta...@gmail.com> with code
that fixed the error (thanks shwetanka):

It seems that user is not getting authenticated and when you are
calling the function login(request, authenticated_user) Anonymous_user
is passed and hence this NotImplementedError is raised. Use
UserManager's create_user method instead for creating the new user.

You can use this way:
if form.isValid():
   cd = form.cleaned_data
   user = User.objects.create_user(cd['username'], cd['email'],
cd['password1'])
   user.save()
   user = authenticate(username=cd['username'],
password=cd['password1'])
   login(request, user)
   .....

Hope this helps. :)

On Jul 23, 9:36 am, Simon Holness <simon.holn...@gmail.com> wrote:
> 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/aut...
> )
>
> 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 
> > athttp://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