Struggling with my very basic django auth login system. When a new user
registers, they are first redirected to `/user/user_id` as I'd like (the
user is being created fine), but they are then redirected to
`/login?next=/user/user_id/` which is being done by the @login_decorator
over the `user` view (the behaviour stops when I remove this decorator).
(nb. Debug toolbar is breaking up the redirect sequence for me to see).
However, if I then manually I include Register view below. I can't see why
it is not logging in immediately upon registration. The login method seems
to be all there:
def register(request):
> if request.method == 'POST':
> form = UserCreationForm(request.POST)
> if form.is_valid():
> new_user = form.save()
> new_user = authenticate(username =
> request.POST['username'],
> password =
> request.POST['password1'])
> login(request, new_user)
> context = RequestContext(request)
> context['user_id'] = new_user.id`
> url = '/user/%s/' % new_user.id
> return HttpResponseRedirect(url)
> else:
> form = UserCreationForm()
> return render_to_response("registration/register.html", {'form':
> form},
> context_instance=RequestContext(request))
Can you help? Thanks.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/AQ1hL2tnJ-gJ.
To post to this group, send email to django-users@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.