Django(其二)
Posted tyh-tesla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django(其二)相关的知识,希望对你有一定的参考价值。
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‘)
以上是关于Django(其二)的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Django Summernote 中显示编程片段的代码块?
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段