Form mixin
CaptchaFormMixin adds the field and forwards the client IP. It uses
the provider named by CAPTCHA_KIT["DEFAULT"], currently
math.
The code
class ContactForm(CaptchaFormMixin, forms.Form):
name = forms.CharField(max_length=100)
email = forms.EmailField()
message = forms.CharField(widget=forms.Textarea)
def contact(request):
form = ContactForm(request.POST or None, request=request)
if request.method == "POST" and form.is_valid():
...
Passing request is optional. It forwards the client IP to the provider
as remoteip, which the services use for risk scoring.