5
我想知道如果auth.logout清除會話數據或我必須由我自己做。Django/Auth:註銷會清除會話數據?
from django.contrib.auth.decorators import login_required
from django.contrib import auth
@login_required
def logout(request):
auth.logout(request)
return redirect('base:homepage')
事情是這樣的......
from django.contrib.auth.decorators import login_required
from django.contrib import auth
@login_required
def logout(request):
for sesskey in request.session.keys():
del request.session[sesskey]
auth.logout(request)
return redirect('base:homepage')
謝謝!
的可能重複(http://stackoverflow.com/questions/12574459/does-the -django認證 - 註銷 - 功能 - 刪除 - 會話行中,Django的-SE) – karthikr 2013-04-05 20:30:10