Why doesn't None put in variable? I wrote in code like
def check(request):
if len(request.POST.get('access_key')) >= 25:
return HttpResponse('<h1>Hello</h1>')
elif request.POST.get('access_key', None) == None:
id_json = {}
return JsonResponse(id_json, safe=False)
else:
return HttpResponse('<h1>Good</h1>')
Now I put anything to access_key in POSTMAN like
I think in this case the program goes into elif request.POST.get('access_key', None) == None:
,but now it goes into else:
.
I really cannot understand why the null value is not recognized as None
. I wrote print(type(request.POST.get('access_key')))
and blank is printed out.
I wanna make a system if no value is put, and the program should go into elif request.POST.get('access_key', None) == None:
.
How should I fix this?