1captcha = fields.ReCaptchaField(
2 widget=widgets.ReCaptchaV2Checkbox(
3 attrs={
4 'data-theme': 'dark',
5 'data-size': 'compact',
6 }
7 )
8)
9# The ReCaptchaV2Invisible widget
10# ignores the "data-size" attribute in favor of 'data-size="invisible"'
11
1RECAPTCHA_PUBLIC_KEY = 'MyRecaptchaKey123'
2RECAPTCHA_PRIVATE_KEY = 'MyRecaptchaPrivateKey456'
3
1from django import forms
2from captcha.fields import ReCaptchaField
3
4class FormWithCaptcha(forms.Form):
5 captcha = ReCaptchaField()
6
1RECAPTCHA_PROXY = {'http': 'http://127.0.0.1:8000', 'https': 'https://127.0.0.1:8000'}
2
1from django import forms
2from captcha.fields import ReCaptchaField
3from captcha.widgets import ReCaptchaV2Invisible
4
5class FormWithCaptcha(forms.Form):
6 captcha = ReCaptchaField(widget=ReCaptchaV2Invisible)
7
1captcha = fields.ReCaptchaField(
2 widget=widgets.ReCaptchaV2Checkbox(
3 api_params={'hl': 'cl', 'onload': 'onLoadFunc'}
4 )
5)
6# The dictionary is urlencoded and appended to the reCAPTCHA api url.
7