mirror of
https://github.com/Hopiu/django-fobi.git
synced 2026-05-24 20:23:44 +00:00
Compat with django 3.1
This commit is contained in:
parent
f5e74c0c94
commit
cbd8849a87
2 changed files with 11 additions and 10 deletions
|
|
@ -2,15 +2,19 @@ from .base import *
|
|||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
|
||||
try:
|
||||
if not 'captcha' in INSTALLED_APPS:
|
||||
INSTALLED_APPS.append('captcha')
|
||||
|
||||
if not 'fobi.contrib.plugins.form_elements.security.recaptcha' \
|
||||
in INSTALLED_APPS:
|
||||
INSTALLED_APPS.append(
|
||||
'fobi.contrib.plugins.form_elements.security.recaptcha'
|
||||
)
|
||||
except Exception as err:
|
||||
pass
|
||||
|
||||
# RECAPTCHA_PUBLIC_KEY = ''
|
||||
# RECAPTCHA_PRIVATE_KEY = ''
|
||||
# Test keys are taken from official dedicated Google page
|
||||
# https://developers.google.com/recaptcha/docs/faq
|
||||
RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
|
||||
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
|
||||
RECAPTCHA_USE_SSL = True
|
||||
SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
|
||||
# FOBI_DEFAULT_THEME = 'simple'
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ DJANGO_SIMPLE_CAPTCHA_INSTALLED = False
|
|||
|
||||
try:
|
||||
from captcha.fields import ReCaptchaField
|
||||
from captcha.widgets import ReCaptcha as ReCaptchaWidget
|
||||
from captcha.widgets import ReCaptchaV2Checkbox as ReCaptchaWidget
|
||||
|
||||
DJANGO_RECAPTCHA_INSTALLED = True
|
||||
except ImportError as e:
|
||||
|
|
@ -98,10 +98,7 @@ class ReCaptchaInputPlugin(FormElementPlugin):
|
|||
'help_text': self.data.help_text,
|
||||
# 'initial': self.data.initial,
|
||||
'required': self.data.required,
|
||||
'widget': ReCaptchaWidget(
|
||||
public_key=settings.RECAPTCHA_PUBLIC_KEY,
|
||||
attrs=widget_attrs
|
||||
),
|
||||
'widget': ReCaptchaWidget(attrs=widget_attrs),
|
||||
}
|
||||
|
||||
return [(self.data.name, ReCaptchaField, field_kwargs)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue