mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
Allow setting to be checked without being created
- Prevents crash when trying to load exported dataset
This commit is contained in:
parent
7f888923c8
commit
39e8b2af0f
@ -23,7 +23,7 @@ class CommonConfig(AppConfig):
|
|||||||
try:
|
try:
|
||||||
import common.models
|
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")
|
logger.info("Clearing SERVER_RESTART_REQUIRED flag")
|
||||||
common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
|
common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
|
||||||
except:
|
except:
|
||||||
|
@ -268,6 +268,10 @@ class BaseInvenTreeSetting(models.Model):
|
|||||||
# Setting does not exist! (Try to create it)
|
# Setting does not exist! (Try to create it)
|
||||||
if not setting:
|
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
|
# Attempt to create a new settings object
|
||||||
setting = cls(
|
setting = cls(
|
||||||
key=key,
|
key=key,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user