2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Merge remote-tracking branch 'inventree/master' into partial-shipment

This commit is contained in:
Oliver
2021-11-15 10:55:17 +11:00
14 changed files with 11254 additions and 2033 deletions

View File

@ -251,6 +251,15 @@ def global_settings(*args, **kwargs):
return InvenTreeSetting.allValues()
@register.simple_tag()
def visible_global_settings(*args, **kwargs):
"""
Return any global settings which are not marked as 'hidden'
"""
return InvenTreeSetting.allValues(exclude_hidden=True)
@register.simple_tag()
def progress_bar(val, max, *args, **kwargs):
"""
@ -292,6 +301,19 @@ def progress_bar(val, max, *args, **kwargs):
@register.simple_tag()
def get_color_theme_css(username):
user_theme_name = get_user_color_theme(username)
# Build path to CSS sheet
inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
# Build static URL
inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
return inventree_css_static_url
@register.simple_tag()
def get_user_color_theme(username):
""" Get current user color theme """
try:
user_theme = ColorTheme.objects.filter(user=username).get()
user_theme_name = user_theme.name
@ -300,13 +322,7 @@ def get_color_theme_css(username):
except ColorTheme.DoesNotExist:
user_theme_name = 'default'
# Build path to CSS sheet
inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
# Build static URL
inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
return inventree_css_static_url
return user_theme_name
@register.simple_tag()