mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
Enhance creation of default settings (#9028)
- Remove cache requirement - Replaces https://github.com/inventree/InvenTree/pull/9021
This commit is contained in:
parent
b6c7a636fd
commit
445fa45394
@ -169,15 +169,6 @@ class BaseInvenTreeSetting(models.Model):
|
||||
|
||||
If a particular setting is not present, create it with the default value
|
||||
"""
|
||||
cache_key = f'BUILD_DEFAULT_VALUES:{cls.__name__!s}'
|
||||
|
||||
try:
|
||||
if InvenTree.helpers.str2bool(cache.get(cache_key, False)):
|
||||
# Already built default values
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
existing_keys = cls.objects.filter(**kwargs).values_list('key', flat=True)
|
||||
settings_keys = cls.SETTINGS.keys()
|
||||
@ -198,11 +189,6 @@ class BaseInvenTreeSetting(models.Model):
|
||||
'Failed to build default values for %s (%s)', str(cls), str(type(exc))
|
||||
)
|
||||
|
||||
try:
|
||||
cache.set(cache_key, True, timeout=3600)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _call_settings_function(self, reference: str, args, kwargs):
|
||||
"""Call a function associated with a particular setting.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user