2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 12:36:45 +00:00

Allow setting to be checked without being created

- Prevents crash when trying to load exported dataset
This commit is contained in:
Oliver 2022-03-09 12:43:27 +11:00
parent 7f888923c8
commit 39e8b2af0f
2 changed files with 18 additions and 14 deletions

View File

@ -23,7 +23,7 @@ class CommonConfig(AppConfig):
try:
import common.models
if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED'):
if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED', backup_value=False, create=False):
logger.info("Clearing SERVER_RESTART_REQUIRED flag")
common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
except:

View File

@ -268,6 +268,10 @@ class BaseInvenTreeSetting(models.Model):
# Setting does not exist! (Try to create it)
if not setting:
# Unless otherwise specified, attempt to create the setting
create = kwargs.get('create', True)
if create:
# Attempt to create a new settings object
setting = cls(
key=key,