diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 374cac24af..a0098d3a0f 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1269,9 +1269,6 @@ def get_price(instance, quantity, moq=True, multiples=True, currency=None, break class ColorTheme(models.Model): """ Color Theme Setting """ - - default_color_theme = ('', _('Default')) - name = models.CharField(max_length=20, default='', blank=True) @@ -1291,10 +1288,7 @@ class ColorTheme(models.Model): # Get color themes choices (CSS sheets) choices = [(file_name.lower(), _(file_name.replace('-', ' ').title())) for file_name, file_ext in files_list - if file_ext == '.css' and file_name.lower() != 'default'] - - # Add default option as empty option - choices.insert(0, cls.default_color_theme) + if file_ext == '.css'] return choices diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 590ea20a6f..dd98eb8c65 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -292,6 +292,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 +313,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() diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html index 89fc67865a..2b2637330c 100644 --- a/InvenTree/templates/InvenTree/settings/user.html +++ b/InvenTree/templates/InvenTree/settings/user.html @@ -170,35 +170,6 @@ - -