From f9fa3344d0d09026ea0b3cc118b7d30d325481cd Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 31 Oct 2019 13:42:04 -0400 Subject: [PATCH] Add savesettings command Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + .../management/commands/savesettings.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 mayan/apps/smart_settings/management/commands/savesettings.py diff --git a/HISTORY.rst b/HISTORY.rst index 2877fb38fa..2c868e820b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -35,6 +35,7 @@ organize cache invalidation of both apps for tests. - Add a version attribute to setting namespace. These are dumped as SMART_SETTINGS_NAMESPACES. +- Add savesettings command. 3.2.8 (2019-10-01) ================== diff --git a/mayan/apps/smart_settings/management/commands/savesettings.py b/mayan/apps/smart_settings/management/commands/savesettings.py new file mode 100644 index 0000000000..4d6e17fd19 --- /dev/null +++ b/mayan/apps/smart_settings/management/commands/savesettings.py @@ -0,0 +1,18 @@ +from __future__ import unicode_literals + +from django.core import management + +from ...classes import Setting + + +class Command(management.BaseCommand): + help = 'Save the current settings into the configuration file.' + + def add_arguments(self, parser): + parser.add_argument( + '--filepath', action='store', dest='filepath', + help='Filename and path where to save the configuration file.' + ) + + def handle(self, *args, **options): + Setting.save_configuration(path=options.get('filepath'))