0
我正在使用recaptcha客户端从谷歌。我注册并获取本地主机的私钥和公钥。 我送再验证码到模板是这样的:在Django中显示纯HTML而不是Captcha小部件?
from django.conf import settings
from summary.captcha import displayhtml
public_key = settings.RECAPTCHA_PUBLIC_KEY
script = displayhtml(public_key=public_key)
return render_to_response('index.html', {'state':state, 'script':script}, context_instance=RequestContext(request))
此HTML显示,而不是小工具:
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6Lf5Cd8SAAAAAD9TUGVAkEOHfHJWnZc9mK2lO5-W"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lf5Cd8SAAAAAD9TUGVAkEOHfHJWnZc9mK2lO5-W" height="300" width="500" frameborder="0"></iframe><br /> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> </noscript>
有什么不对?
也许有你错过了把你的代码的东西 – catherine 2013-03-28 07:31:28