djblets.recaptcha.mixins¶
Mixins for providing reCAPTCHA validation support in forms.
See Using reCAPTCHA for a guide on using reCAPTCHA validation.
- class RecaptchaFormMixin(*args, **kwargs)¶
Bases:
Form
A form mixin for providing reCAPTCHA verification.
If other mixins are used, this should be the first in the list of base classes to ensure the reCAPTCHA field is the last.
Users of this mixin must set the
request
attribute as the currentHttpRequest
instance beforeclean()
is called.- __init__(*args, **kwargs)¶
Initialize the mixin.
- property verify_recaptcha¶
Whether or not the reCAPTCHA is to be verified.
- Returns:
bool Whether or not the reCAPTCHA is to be verified.
- clean()¶
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- __annotations__ = {}¶
- declared_fields = {}¶