django create user and log them in
- by Scott Willman
In a view I'm trying to create a new user and then log them in but result in a new url on success.
def create(request):
if request.method == "POST":
# do user creation #
user.save()
auth_user = authenticate(username=user.username,password=user.password)
if auth_user is not None:
login(request, auth_user)
return HttpResponseRedirect('/user/account/')
return render_to_response('create_form.html')
So, how do I maintain the user object using the HttpResponseRedirect or validate the logged in user in an unassociated view?