Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 March 26, 2008 18:53:13

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Log a user in after registration?


I want to log a user in after they have registered on my site.

Right now, I am using django-registration to handle user registration
but it is modified to not have activation. I know it doesn't really
matter what I am using as all the login is handled by
django.contrib.auth

I've looked in the files and tried to replicate it, but all I get is
various errors. I am probably doing it horrilbly wrong. I simply want
to pass in the users new information, and then have it log them in

I've tried doing:
login(request, new_user) after my user has registered, new_user is
the info I get from registering.

login is referencing: from django.contrib.auth import login (I import
it right beofre that line). I've gotten the following error now:

'User' object has no attribute 'backend'
Request Method: POST
Request URL:http://localhost:8000/accounts/register/Exception Type: AttributeError
Exception Value: 'User' object has no attribute 'backend'


Here is my registration code and where I am calling login. What is
wrong with this?
if request.method == 'POST':
form = form_class(request.POST)
if form.is_valid():
new_user = form.save(profile_callback=profile_callback)

from django.contrib.auth import login
login(request, new_user)

return HttpResponseRedirect(success_url)
else:
form = form_class()
return render_to_response(template_name,
{ 'form': form },
context_instance=RequestContext(request))
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 March 26, 2008 19:02:57

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Log a user in after registration?


You need to call authenticate() before you can call login()http://www.djangoproject.com/documentation/authentication/#how-to-log-a-user-inOn Mar 26, 10:52 pm, truebosko <> wrote:
> I want to log a user in after they have registered on my site.
>
> Right now, I am using django-registration to handle user registration
> but it is modified to not have activation. I know it doesn't really
> matter what I am using as all the login is handled by
> django.contrib.auth
>
> I've looked in the files and tried to replicate it, but all I get is
> various errors. I am probably doing it horrilbly wrong. I simply want
> to pass in the users new information, and then have it log them in
>
> I've tried doing:
> login(request, new_user) after my user has registered, new_user is
> the info I get from registering.
>
> login is referencing: from django.contrib.auth import login (I import
> it right beofre that line). I've gotten the following error now:
>
> 'User' object has no attribute 'backend'
> Request Method: POST
> Request URL:http://localhost:8000/accounts/register/> Exception Type: AttributeError
> Exception Value: 'User' object has no attribute 'backend'
>
> Here is my registration code and where I am calling login. What is
> wrong with this?
> if request.method == 'POST':
> form = form_class(request.POST)
> if form.is_valid():
> new_user = form.save(profile_callback=profile_callback)
>
> from django.contrib.auth import login
> login(request, new_user)
>
> return HttpResponseRedirect(success_url)
> else:
> form = form_class()
> return render_to_response(template_name,
> { 'form': form },
> context_instance=RequestContext(request))
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#3 March 26, 2008 20:07:37

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Log a user in after registration?


Woohoo .. simple enough, totally did not remember that :) Thanks,
works great now

On Mar 26, 2:02 pm, shabda <> wrote:
> You need to call authenticate() before you can call
> login()http://www.djangoproject.com/documentation/authentication/#how-to-log...
>
> On Mar 26, 10:52 pm, truebosko <> wrote:
>
> > I want to log a user in after they have registered on my site.
>
> > Right now, I am using django-registration to handle user registration
> > but it is modified to not have activation. I know it doesn't really
> > matter what I am using as all the login is handled by
> > django.contrib.auth
>
> > I've looked in the files and tried to replicate it, but all I get is
> > various errors. I am probably doing it horrilbly wrong. I simply want
> > to pass in the users new information, and then have it log them in
>
> > I've tried doing:
> >  login(request, new_user)  after my user has registered, new_user is
> > the info I get from registering.
>
> > login is referencing: from django.contrib.auth import login (I import
> > it right beofre that line). I've gotten the following error now:
>
> > 'User' object has no attribute 'backend'
> > Request Method:         POST
> > Request URL:http://localhost:8000/accounts/register/> > Exception Type:         AttributeError
> > Exception Value:        'User' object has no attribute 'backend'
>
> > Here is my registration code and where I am calling login. What is
> > wrong with this?
> > if request.method == 'POST':
> >         form = form_class(request.POST)
> >         if form.is_valid():
> >             new_user = form.save(profile_callback=profile_callback)
>
> >             from django.contrib.auth import login
> >             login(request, new_user)
>
> >             return HttpResponseRedirect(success_url)
> >     else:
> >         form = form_class()
> >     return render_to_response(template_name,
> >                               { 'form': form },
> >                               context_instance=RequestContext(request))
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support