2👍
✅
By reading the code and the error, I assume that validate
is a view. A view must always return a HttpResponse
. So if you want to return a response indicating a boolean value, indicating if captchavalue == key
, do:
from django.http import HttpResponse
def validate(request):
id=request.GET.get('id','')
key=request.GET.get('key','')
captchavalue = mc.get(str(id))
return HttpResponse(captchavalue == key)
I’m not 100% sure about the import line, but it’s something very similar.
0👍
I don’t know much Django, but it seems it expects you to return a response object instead of a bool value (True / False).
Maybe your code should like more like this:
if captchvalue == key:
return HttpResponse('HTML Page saying OK')
else:
return HttpResponse('HTML Page saying Error')
- [Answered ]-Django kept previous data in database
- [Answered ]-Linkedin language code change
- [Answered ]-Can I change the template search behavior of class based views?
- [Answered ]-How to strip(not remove) specified tags from a html string using Python?
Source:stackexchange.com