Jump to >

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)[source]

Bases: django.forms.forms.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 current HttpRequest instance before clean() is called.

__init__(*args, **kwargs)[source]

Initialize the mixin.

Parameters:
  • *args (tuple) – Additional positional arguments to pass to the superclass constructor.
  • **kwargs (dict) – Additional keyword arguments to pass to the superclass constructor.
verify_recaptcha[source]

Whether or not the reCAPTCHA is to be verified.

Returns:bool Whether or not the reCAPTCHA is to be verified.
clean()[source]