mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
get user settings in templates
This commit is contained in:
parent
50356afd41
commit
e167f27258
@ -194,7 +194,7 @@ class BaseInvenTreeSetting(models.Model):
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_setting(cls, key, backup_value=None):
|
||||
def get_setting(cls, key, backup_value=None, **kwargs):
|
||||
"""
|
||||
Get the value of a particular setting.
|
||||
If it does not exist, return the backup value (default = None)
|
||||
@ -204,7 +204,7 @@ class BaseInvenTreeSetting(models.Model):
|
||||
if backup_value is None:
|
||||
backup_value = cls.get_setting_default(key)
|
||||
|
||||
setting = cls.get_setting_object(key)
|
||||
setting = cls.get_setting_object(key, **kwargs)
|
||||
|
||||
if setting:
|
||||
value = setting.value
|
||||
|
@ -196,6 +196,8 @@ def settings_value(key, *args, **kwargs):
|
||||
Return a settings value specified by the given key
|
||||
"""
|
||||
|
||||
if 'user' in kwargs:
|
||||
return InvenTreeUserSetting.get_setting(key, user=kwargs['user'])
|
||||
return InvenTreeSetting.get_setting(key)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user