Add support for YAML configuration files. Add support for editing setting options and saving them using the new YAML configuration file support. Add new revertsettings management command. Add new permission to edit setting via the UI.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-08-16 03:05:26 -04:00
parent ac5f53c538
commit 90cd142e76
17 changed files with 269 additions and 35 deletions

View File

@@ -0,0 +1,29 @@
from __future__ import unicode_literals
import errno
import os
from shutil import copyfile
from django.conf import settings
from django.core import management
from django.core.management.utils import get_random_secret_key
class Command(management.BaseCommand):
help = 'Rollback the configuration file to the last valid version.'
def handle(self, *args, **options):
try:
copyfile(
settings.CONFIGURATION_LAST_GOOD_FILEPATH,
settings.CONFIGURATION_FILEPATH
)
except IOError as exception:
if exception.errno == errno.ENOENT:
self.stdout.write(
self.style.NOTICE(
'There is no last valid version to restore.'
)
)
else:
raise