1👍
✅
AFAIK, request.POST
has dictionary structure; it has key and value. Assuming that request.POST
has {'key': 'OK'}
, the conditional statement would be appropriate if
if request.POST['key'] == 'OK':
or this would be better
if request.POST.get('key') == 'OK':
because request.POST.get
gives None
if it has no such key.
Source:stackexchange.com