标签:login col username obj response span dex html div
session
def session_login(request): if request.method==‘POST‘: username = request.POST.get(‘user‘) password = request.POST.get(‘pwd‘) user = UserInfo.objects.filter(name=username,pwd=password).first() if user: request.session[‘is_login‘]=True request.session[‘username‘]=user.name return HttpResponse(‘登录成功!‘) else: return redirect(‘/cookie/‘) return render(request,"cookie.html") def session_index(request): session_name = request.session[‘is_login‘] if session_name: username = request.session[‘username‘] return render(request,"c_index.html",{‘username‘:username}) return render(request,‘c_index.html‘)
标签:login col username obj response span dex html div
原文地址:https://www.cnblogs.com/tyh-tesla/p/9974965.html