updated settings.

This commit is contained in:
2018-04-06 15:14:12 +01:00
parent 5f6ce8a754
commit 8d9422e0e3
4 changed files with 4 additions and 56 deletions

View File

@@ -203,27 +203,6 @@ class SettingsForm(forms.Form):
'class': 'form-control'
}
))
recaptcha = forms.BooleanField(help_text='Use Recaptcha',
required=False,
widget=forms.CheckboxInput(
attrs={
'class': 'checkbox'
}
))
recaptcha_public_key = forms.CharField(help_text='Recaptcha Public Key',
required=False,
widget=forms.TextInput(
attrs={
'class': 'form-control'
}
))
recaptcha_private_key = forms.CharField(help_text='Recaptcha Private Key',
required=False,
widget=forms.TextInput(
attrs={
'class': 'form-control'
}
))
def clean_base_dir(self):
data = self.cleaned_data['base_dir']
@@ -234,17 +213,8 @@ class SettingsForm(forms.Form):
@staticmethod
def get_initial_values():
base_dir, _ = Setting.objects.get_or_create(name='BASE_DIR')
recaptcha_public_key, _ = Setting.objects.get_or_create(name='RECAPTCHA_PUBLIC_KEY')
recaptcha_private_key, _ = Setting.objects.get_or_create(name='RECAPTCHA_PRIVATE_KEY')
recaptcha, _ = Setting.objects.get_or_create(name='RECAPTCHA')
if recaptcha.value == '1':
recaptcha = True
else:
recaptcha = False
initial = {
'base_dir': base_dir.value,
'recaptcha': recaptcha,
'recaptcha_public_key': recaptcha_public_key.value,
'recaptcha_private_key': recaptcha_private_key.value,
}
return initial