problem description
cannot be received at the front end of return JsonResponse after request.session assignment?
related codes
/ / Please paste the code text below (do not replace the code with pictures)
CheckLoginAccount = models.Account.objects.filter (Username=request.POST ["Username"], Password=request.POST [" Password"])
CheckResult = len (CheckLoginAccount) = = 1
if CheckResult:
-sharpreturn JsonResponse({"AuthenticationResult":"Success"})jsonrequest.sessionreturn500try catch
request.session["Account"]=CheckLoginAccount
return JsonResponse({"AuthenticationResult":"Success"})
what result do you expect? What is the error message actually seen?
tried to write this:
request.session["Account"]=CheckLoginAccount
try:
return JsonResponse({"AuthenticationResult":"Success"})
except Exception as e1:
...
vs2015 does not report errors, but the front end still does not receive json objects?
guess that after the modification of request.session, the front end and background are no longer matched. We don"t know each other anymore.