2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-02 05:26:45 +00:00

jump over if static dir does not exsist

This commit is contained in:
Matthias 2022-05-18 23:31:44 +02:00
parent 16dad60ea5
commit 51cd038f04
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093

View File

@ -13,6 +13,7 @@ import hashlib
import base64 import base64
from secrets import compare_digest from secrets import compare_digest
from datetime import datetime, timedelta from datetime import datetime, timedelta
import warnings
from django.apps import apps from django.apps import apps
from django.db import models, transaction from django.db import models, transaction
@ -1695,6 +1696,11 @@ class ColorTheme(models.Model):
def get_color_themes_choices(cls): def get_color_themes_choices(cls):
""" Get all color themes from static folder """ """ 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 # Get files list from css/color-themes/ folder
files_list = [] files_list = []
for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR): for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR):