Why is this running into an infinite loop, and 'TESTING' never gets printed? It seems like the logout
function is causing the page to redirect to itself, but the documentation suggests that you can put your own redirect after calling that function.
def logout(request):
logout(request)
print 'TESTING'
messages.success(request, 'Logged out.')
return HttpResponseRedirect(request.GET['next'] or reverse('home'))
Is there another way to log the user out, if this logout function has some hidden redirect functionality?
Just took a peek at the source code, nothing suspicious there:
def logout(request):
"""
Removes the authenticated user's ID from the request and flushes their
session data.
"""
request.session.flush()
if hasattr(request, 'user'):
from django.contrib.auth.models import AnonymousUser
request.user = AnonymousUser()
I really can't imagine what's causing this.