Django request.session returns the json object after assigning a value. Why does the background not report an error but the front end cannot receive it?

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.

Jan.02,2022

solved.
the problem lies in the sentence written to session. Django only allows strings to be saved in session.
in this section of the program, CheckLoginAccount is an object.

Menu