While running this function to validate captcha key and value i am not able to return
it show error like this
“AttributeError: ‘bool’ object has no attribute ‘status_code'”
def validate(request):
id=request.GET.get('id','')
key=request.GET.get('key','')
captchavalue = mc.get(str(id))
if captchavalue == key:
return True
else:
return False
By reading the code and the error, I assume that
validateis a view. A view must always return aHttpResponse. So if you want to return a response indicating a boolean value, indicating ifcaptchavalue == key, do:I’m not 100% sure about the import line, but it’s something very similar.