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?
The session middleware should handle this transparently. If you’re finding that this isn’t the case then you should be looking in that direction for problems.