Added CONSTANCE_IGNORE_ADMIN_VERSION_CHECK settings option to ignore the version protection. When you use django-constance on a cloud platform, with several machines, giving you problems by keeping the machine does not have to be the same which has served constant form.

This commit is contained in:
Francesc Arpi 2016-03-01 17:37:35 +01:00
parent 70c4f0a3ad
commit 1b9458c74b
2 changed files with 8 additions and 0 deletions

View file

@ -103,6 +103,10 @@ class ConstanceForm(forms.Form):
def clean_version(self):
value = self.cleaned_data['version']
if settings.IGNORE_ADMIN_VERSION_CHECK:
return value
if value != self.initial['version']:
raise forms.ValidationError(_('The settings have been modified '
'by someone else. Please reload the '

View file

@ -24,3 +24,7 @@ REDIS_CONNECTION_CLASS = getattr(settings, 'CONSTANCE_REDIS_CONNECTION_CLASS',
REDIS_CONNECTION = getattr(settings, 'CONSTANCE_REDIS_CONNECTION', {})
SUPERUSER_ONLY = getattr(settings, 'CONSTANCE_SUPERUSER_ONLY', True)
IGNORE_ADMIN_VERSION_CHECK = getattr(settings,
'CONSTANCE_IGNORE_ADMIN_VERSION_CHECK',
False)