I put the google recaptcha V2 to my django project form. It looks like working, but if I leave empty the recaptcha checkbox my form is sent still.
forms.py from django import forms from captcha.fields import ReCaptchaField from django.forms import Textarea from .models import * class CustomerForm(forms.ModelForm): captcha = ReCaptchaField( public_key='key', private_key='key', ) class Meta: model = Customer fields = '__all__' def __init__(self, *args, **kwargs): # get 'user' param from kwargs user = kwargs.pop('user', None) super().__init__(*args, **kwargs) self.fields['message'].widget = Textarea(attrs={'rows': 4}) self.fields['i_have_read_rules'].widget.attrs['required'] = 'True' self.fields['i_agree'].widget.attrs['required'] = 'True' self.fields['captcha'].widget.attrs['required'] = 'True' for field in self.fields: self.fields[field].widget.attrs['class'] = 'form-control' self.fields['i_have_read_rules'].widget.attrs['class'] = 'form-check' self.fields['i_agree'].widget.attrs['class'] = 'form-check' html <form id="add_form_order" method="post"> {% csrf_token %} <h6 class="block-title">Выберите услугу</h6> <div class="form-group">{{form.choice_services}}</div> <div class="form-group">{{form.name}}</div> <div class="form-group">{{form.telephone_number}}</div> <div class="form-group">{{form.email}}</div> <div class="form-group">{{form.message}}</div> <div class="form-group">{{form.contact_text}}</div> {{ form.captcha }} </form> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e18dcba2-07e2-44d9-ace6-744a2bb69234n%40googlegroups.com.