标签:style blog http color 使用 io ar html
设置:auth.login(request, user)
response = HttpResponseRedirect(reverse("index"))
response.set_cookie(‘xiang‘, username, 3600)
return response
获取:
def index(req):
username = req.COOKIES.get(‘username‘,‘‘)
return render_to_response(‘index.html‘ ,{‘username‘:username})
删除:
def logout(req):
response = HttpResponse(‘logout !!‘) #清理cookie里保存username
response.delete_cookie(‘username‘)
return response
使用:
{{username}}
session与cookie
http://www.cnblogs.com/lhj588/archive/2011/10/27/2226976.html
标签:style blog http color 使用 io ar html
原文地址:http://www.cnblogs.com/tuifeideyouran/p/3924281.html