function codes() {
url = '/captcha/refresh?' + Math.random()
$.get(url, function (result) {
console.log(result.image_url)
$('img[class="captcha"]').attr('src', result.image_url)
$('#id_captcha_0').attr('value', result.key)
})
}
$('img[class="captcha"]').mousedown(function () {
console.log('备点了')
codes()
})
需要包 1. pip install django-simple-captcha 目前安装的是0.3.4版本。 手工下载可以安装 0.3.6最新版。