Basically, I'm trying to redirect people who aren't logged in to the login page.
What I'm currently using is:
return render_to_response('login.html', context_instance=RequestContext(request))
But that leaves the url at the homepage. I'd like to have it redirect to /accounts/login/, but when I use
return HttpResponseRedirect('/accounts/login/')
I get the error
Key 'username' not found in <QueryDict: {}>
I understand that to mean that I do need to have
context_instance=RequestContext(request))
Is there anyway to have a proper redirect, and still pass RequestContext along?