🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
>[success] # views 写法 ~~~ def login(request): if request.method == "GET": login_form = LoginForm(request) return render(request,"login.html",{"login_form":login_form}) elif request.method == "POST": login_form = LoginForm(request,request.POST) ret = {"status":True,"message":None} if login_form.is_valid(): return HttpResponse(json.dumps(ret)) else: ret['status'] = False if "check_box" in login_form.errors: ret['message'] = "验证码错误" else: ret['message'] = "用户名错误" return HttpResponse(json.dumps(ret)) ~~~