recaptcha form fix

This commit is contained in:
2020-10-30 15:30:25 +01:00
parent 322786cdba
commit c6610b8c5c
6 changed files with 34 additions and 7 deletions

View File

@@ -8,6 +8,9 @@ from djangocms_picture.cms_plugins import PicturePlugin as _PicturePlugin
from djangocms_text_ckeditor.cms_plugins import TextPlugin as _TextPlugin
from django.contrib import admin
from mailchimp3 import MailChimp
from aldryn_forms.cms_plugins import Field
from snowpenguin.django.recaptcha2.fields import ReCaptchaField
from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
from project.forms import NewsletterSubscriptionForm
from project.models import Section, Quote, SliderItem, SectionText, Video, DownloadSection, DownloadSectionFolder, \
@@ -206,6 +209,24 @@ class FormPlugin(_FormPlugin):
'SubmitButton', 'ReCaptchaFieldPlugin']
@plugin_pool.register_plugin
class ReCaptchaFieldPlugin(Field):
name = 'ReCaptcha Field'
render_template = True
allow_children = False
form_field = ReCaptchaField
form_field_widget = ReCaptchaWidget
form_field_enabled_options = [
'error_messages',
]
fieldset_general_fields = []
fieldset_advanced_fields = []
def get_form_field_widget_kwargs(self, instance):
return {'explicit': True}
class SocialMediaListItemInlineAdmin(admin.TabularInline):
model = SocialMediaListItem
extra = 0

View File

@@ -1,4 +1,4 @@
{% load static i18n cms_tags sekizai_tags fontawesome menu_tags %}<!DOCTYPE html>
{% load static i18n cms_tags sekizai_tags fontawesome menu_tags recaptcha2 %}<!DOCTYPE html>
<html class="r" lang="{{ LANGUAGE_CODE }}">
<head>
<meta http-equiv="x-ua-compatible" content="ie=edge">
@@ -10,6 +10,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google" content="notranslate">
{% recaptcha_explicit_support %}
<meta name="msvalidate.01" content="7E7A1E68251AEDF0AF320164C774E3E8"/>
{% block extra_meta %}
@@ -233,5 +235,7 @@
});
});
</script>
{% recaptcha_explicit_init LANGUAGE_CODE %}
</body>
</html>