From 51cd038f04521346e433ee1dd63a17507a03a050 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 18 May 2022 23:31:44 +0200 Subject: [PATCH] jump over if static dir does not exsist --- InvenTree/common/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 83773fe48a..1db60219dd 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -13,6 +13,7 @@ import hashlib import base64 from secrets import compare_digest from datetime import datetime, timedelta +import warnings from django.apps import apps from django.db import models, transaction @@ -1695,6 +1696,11 @@ class ColorTheme(models.Model): def get_color_themes_choices(cls): """ Get all color themes from static folder """ + # Check that settings exsist + if not os.path.exists(settings.STATIC_COLOR_THEMES_DIR): + warnings.warn('No Theme-data found') + return [] + # Get files list from css/color-themes/ folder files_list = [] for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR):