手记

python为啥标题要这么长?

<pre>
def login(request):
if request.method == "GET":
return render(request, 'login.html')
elif request.method == "POST":
username = request.POST.get('username','')
password = request.POST.get('password','')
print username, password

models.UserInfo.objects.create(user=username, password=password)
    result = models.UserInfo.objects.filter(user=username,password=password)
    resulta = models.UserInfo.objects.filter(user=username,password=password).first()
    if result:
        print result
        print resulta
    else:
        return HttpResponse('用户名或密码错误')
return render(request, 'index.html', {'result': result})</pre>
2人推荐
随时随地看视频
慕课网APP

热门评论

def login(request):
    if request.method == "GET":
        return render(request, 'login.html')
    elif request.method == "POST":
        username = request.POST.get('username','')
        password = request.POST.get('password','')
        print username, password
        # models.UserInfo.objects.create(user=username, password=password)
        result = models.UserInfo.objects.filter(user=username,password=password)
        resulta = models.UserInfo.objects.filter(user=username,password=password).first()
        if result:
            print result
            print resulta
        else:
            return HttpResponse('用户名或密码错误')
    return render(request, 'index.html', {'result': result})


查看全部评论