From 17f9a3d42c35081027d741784889575cf7992958 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 08:27:48 +0100 Subject: [PATCH 01/13] Fix typo --- src/argus_htmx/templates/htmx/user/preferences.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/argus_htmx/templates/htmx/user/preferences.html b/src/argus_htmx/templates/htmx/user/preferences.html index 32d625de..c81ebec6 100644 --- a/src/argus_htmx/templates/htmx/user/preferences.html +++ b/src/argus_htmx/templates/htmx/user/preferences.html @@ -9,7 +9,7 @@

User preferences

Logged in as: {{ request.user }}
-
  • {% include "htmx/themes/theme_dropdown.html" %}
  • +
  • {% include "htmx/themes/_theme_dropdown.html" %}
  • {% include "htmx/dateformat/_dateformat_dropdown.html" %}
  • {% include "htmx/page_size/_page_size_dropdown.html" %}
  • From e08497e734b1cb3a4f080943f2ff4244620814ad Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 6 Nov 2024 11:05:43 +0100 Subject: [PATCH 02/13] Make themes list depend on installed themes --- README.rst | 4 ++- src/argus_htmx/appconfig.py | 1 + src/argus_htmx/apps.py | 5 ++++ src/argus_htmx/checks.py | 30 +++++++++++++++++++ src/argus_htmx/context_processors.py | 10 ++----- src/argus_htmx/settings.py | 2 ++ src/argus_htmx/themes/utils.py | 43 +++++++++++++++++++++++----- 7 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 src/argus_htmx/checks.py diff --git a/README.rst b/README.rst index ccbb285b..3687625e 100644 --- a/README.rst +++ b/README.rst @@ -242,7 +242,9 @@ How to customize the look: * `list of daisyUI color names`_ * `Tailwind CSS theme customization`_ -* Override the default main stylesheet path by providing a ``path_to_stylesheet`` value in a template ``context``. +* Override the default main stylesheet path by setting ``STYLESHEET_PATH`` in + the environment. The path is under ``STATIC_URL``. This depends on the + context processor ``argus_htmx.context_processors.path_to_stylesheet``. * Include additional styles/stylesheets using the ``head`` block in your templates. * Generate a Tailwind config file by running the ``tailwind_config`` management command. By default the generated file will be based on diff --git a/src/argus_htmx/appconfig.py b/src/argus_htmx/appconfig.py index 62be90b2..534e6015 100644 --- a/src/argus_htmx/appconfig.py +++ b/src/argus_htmx/appconfig.py @@ -25,6 +25,7 @@ }, "context_processors": [ "argus.auth.context_processors.preferences", + "argus_htmx.context_processors.path_to_stylesheet", ], "middleware": { "argus_htmx.middleware.LoginRequiredMiddleware": "end", diff --git a/src/argus_htmx/apps.py b/src/argus_htmx/apps.py index cefe9aad..cc6169b5 100644 --- a/src/argus_htmx/apps.py +++ b/src/argus_htmx/apps.py @@ -1,4 +1,5 @@ import pathlib + from django.apps import AppConfig @@ -9,3 +10,7 @@ class HtmxFrontendConfig(AppConfig): def tailwind_css_files(self): yield from pathlib.Path(__file__).parent.glob("tailwindtheme/snippets/*.css") + + def ready(self): + # Register checks + from .checks import check_for_valid_themes_list # noqa: F401 diff --git a/src/argus_htmx/checks.py b/src/argus_htmx/checks.py new file mode 100644 index 00000000..e5ed5a62 --- /dev/null +++ b/src/argus_htmx/checks.py @@ -0,0 +1,30 @@ +from django.core.checks import Error, register +from django.core.exceptions import ImproperlyConfigured + +from .themes.utils import get_theme_names + + +@register +def check_for_valid_themes_list(app_configs, **kwargs): + errors = [] + themes = [] + try: + themes = get_theme_names() + except ImproperlyConfigured as e: + errors.append( + Error( + str(e), + hint="Regenerate styles.css", + id="argus_htmx.T001", + ) + ) + else: + if not themes: + errors.append( + Error( + "no themes installed", + hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate styles.css', + id="argus_htmx.T002", + ) + ) + return errors diff --git a/src/argus_htmx/context_processors.py b/src/argus_htmx/context_processors.py index 67ccdd68..3f2b002e 100644 --- a/src/argus_htmx/context_processors.py +++ b/src/argus_htmx/context_processors.py @@ -7,12 +7,8 @@ See django settings for ``TEMPLATES``. """ -from argus.auth.models import Preferences +from .settings import STYLESHEET_PATH -def preferences(request): - pref_sets = Preferences.objects.filter(user=request.user) - prefdict = {} - for pref_set in pref_sets: - prefdict[pref_set._namespace] = pref_set.get_context() - return {"preferences": prefdict} +def path_to_stylesheet(request): + return {"path_to_stylesheet": STYLESHEET_PATH} diff --git a/src/argus_htmx/settings.py b/src/argus_htmx/settings.py index d72f9f81..fec5ac11 100644 --- a/src/argus_htmx/settings.py +++ b/src/argus_htmx/settings.py @@ -25,6 +25,7 @@ TAILWIND_CONFIG_TARGET = "src/argus_htmx/tailwindtheme/tailwind.config.js" TAILWIND_CSS_TARGET = "src/argus_htmx/tailwindtheme/styles.css" +STYLESHEET_PATH_DEFAULT = "styles.css" DEFAULT_THEMES = [ "dark", "light", @@ -57,3 +58,4 @@ THEME_DEFAULT = get_str_env("ARGUS_THEME_DEFAULT", "argus") DEFAULT_THEME_OVERRIDE = {} TAILWIND_THEME_OVERRIDE = get_json_env("TAILWIND_THEME_OVERRIDE", DEFAULT_THEME_OVERRIDE, quiet=True) +STYLESHEET_PATH = get_str_env("STYLESHEET_PATH", STYLESHEET_PATH_DEFAULT) diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 9927bb5a..8ca30255 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -1,15 +1,19 @@ +from importlib.resources import files +from pathlib import Path + from django.conf import settings -from argus_htmx import settings as argus_htmx_settings +from django.core.exceptions import ImproperlyConfigured +from argus_htmx import settings as default_htmx_settings -def get_themes(): - return getattr(settings, "DAISYUI_THEMES", argus_htmx_settings.DAISYUI_THEMES) +__all__ = ["get_theme_names"] -def get_theme_names(): - themes = get_themes() + +def get_themes_from_setting(): + themes_setting = getattr(settings, "DAISYUI_THEMES", default_htmx_settings.DAISYUI_THEMES) theme_names = [] - for theme in themes: + for theme in themes_setting: if isinstance(theme, str): theme_names.append(theme) elif isinstance(theme, dict): @@ -17,5 +21,30 @@ def get_theme_names(): return theme_names +def get_themes_from_css(): + static_url = Path(settings.STATIC_URL).relative_to("/") + stylesheet_path = static_url / default_htmx_settings.STYLESHEET_PATH + styles_css = files("argus_htmx").joinpath(stylesheet_path).read_text() + styles_css_lines = styles_css.split("{") + theme_names = [] + for line in styles_css_lines: + if "data-theme=" not in line: + continue + _, after = line.split("=", 1) + theme_name, _ = after.split("]", 1) + theme_names.append(theme_name.strip()) + return theme_names + + +def get_theme_names(): + themes_from_setting = set(get_themes_from_setting()) + themes_from_css = set(get_themes_from_css()) + installed_themes = themes_from_setting | themes_from_css + all_themes = themes_from_setting & themes_from_css + if all_themes != installed_themes: + raise ImproperlyConfigured("Themes in settings is out of sync with themes installed") + return installed_themes + + def get_theme_default(): - return getattr(settings, "THEME_DEFAULT", argus_htmx_settings.THEME_DEFAULT) + return getattr(settings, "THEME_DEFAULT", default_htmx_settings.THEME_DEFAULT) From 0385d63861b592305a4fdc63dacd561a40ff43d8 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 13 Nov 2024 09:39:06 +0100 Subject: [PATCH 03/13] use regex --- src/argus_htmx/themes/utils.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 8ca30255..3a7bda7e 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -1,5 +1,6 @@ from importlib.resources import files from pathlib import Path +from re import findall from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -22,18 +23,14 @@ def get_themes_from_setting(): def get_themes_from_css(): + THEME_NAME_RE = "(?P\w+)" + DATA_THEME_RE = f"\[data-theme={THEME_NAME_RE}\]" + static_url = Path(settings.STATIC_URL).relative_to("/") stylesheet_path = static_url / default_htmx_settings.STYLESHEET_PATH styles_css = files("argus_htmx").joinpath(stylesheet_path).read_text() - styles_css_lines = styles_css.split("{") - theme_names = [] - for line in styles_css_lines: - if "data-theme=" not in line: - continue - _, after = line.split("=", 1) - theme_name, _ = after.split("]", 1) - theme_names.append(theme_name.strip()) - return theme_names + + return findall(DATA_THEME_RE, styles_css) def get_theme_names(): From e78cc5d997b57a9039ad6e3ad5d1592972388945 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 13 Nov 2024 09:42:08 +0100 Subject: [PATCH 04/13] change envname --- src/argus_htmx/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/argus_htmx/settings.py b/src/argus_htmx/settings.py index fec5ac11..00f14bb0 100644 --- a/src/argus_htmx/settings.py +++ b/src/argus_htmx/settings.py @@ -58,4 +58,4 @@ THEME_DEFAULT = get_str_env("ARGUS_THEME_DEFAULT", "argus") DEFAULT_THEME_OVERRIDE = {} TAILWIND_THEME_OVERRIDE = get_json_env("TAILWIND_THEME_OVERRIDE", DEFAULT_THEME_OVERRIDE, quiet=True) -STYLESHEET_PATH = get_str_env("STYLESHEET_PATH", STYLESHEET_PATH_DEFAULT) +STYLESHEET_PATH = get_str_env("ARGUS_STYLESHEET_PATH", STYLESHEET_PATH_DEFAULT) From e62a8aadb756d6b00f2cec3c398e88e11d356466 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 13 Nov 2024 09:43:59 +0100 Subject: [PATCH 05/13] update readme --- README.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 3687625e..af8aca80 100644 --- a/README.rst +++ b/README.rst @@ -242,9 +242,10 @@ How to customize the look: * `list of daisyUI color names`_ * `Tailwind CSS theme customization`_ -* Override the default main stylesheet path by setting ``STYLESHEET_PATH`` in - the environment. The path is under ``STATIC_URL``. This depends on the - context processor ``argus_htmx.context_processors.path_to_stylesheet``. +* Override the default main stylesheet path by setting + ``ARGUS_STYLESHEET_PATH`` in the environment. The path is under + ``STATIC_URL``. This depends on the context processor + ``argus_htmx.context_processors.path_to_stylesheet``. * Include additional styles/stylesheets using the ``head`` block in your templates. * Generate a Tailwind config file by running the ``tailwind_config`` management command. By default the generated file will be based on From f54555d0d158790fd6ae8a9d497f97d050bcb673 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 13 Nov 2024 14:22:51 +0100 Subject: [PATCH 06/13] also get stylesheet path from compiled settings --- src/argus_htmx/themes/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 3a7bda7e..7d715687 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -8,7 +8,10 @@ from argus_htmx import settings as default_htmx_settings -__all__ = ["get_theme_names"] +__all__ = [ + "get_theme_names", + "get_theme_default", +] def get_themes_from_setting(): @@ -22,12 +25,16 @@ def get_themes_from_setting(): return theme_names +def get_stylesheet_path(): + return getattr(settings, "STYLESHEET_PATH", default_htmx_settings.STYLESHEET_PATH) + + def get_themes_from_css(): THEME_NAME_RE = "(?P\w+)" DATA_THEME_RE = f"\[data-theme={THEME_NAME_RE}\]" static_url = Path(settings.STATIC_URL).relative_to("/") - stylesheet_path = static_url / default_htmx_settings.STYLESHEET_PATH + stylesheet_path = static_url / get_stylesheet_path() styles_css = files("argus_htmx").joinpath(stylesheet_path).read_text() return findall(DATA_THEME_RE, styles_css) From 5a9dbeb2e347f1e67e6a31b8af27042a5a06ad16 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Wed, 13 Nov 2024 14:24:05 +0100 Subject: [PATCH 07/13] improve naming --- src/argus_htmx/themes/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 7d715687..5be8fef8 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -5,7 +5,7 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from argus_htmx import settings as default_htmx_settings +from argus_htmx import settings as fallbacks __all__ = [ @@ -15,7 +15,7 @@ def get_themes_from_setting(): - themes_setting = getattr(settings, "DAISYUI_THEMES", default_htmx_settings.DAISYUI_THEMES) + themes_setting = getattr(settings, "DAISYUI_THEMES", fallbacks.DAISYUI_THEMES) theme_names = [] for theme in themes_setting: if isinstance(theme, str): @@ -26,7 +26,7 @@ def get_themes_from_setting(): def get_stylesheet_path(): - return getattr(settings, "STYLESHEET_PATH", default_htmx_settings.STYLESHEET_PATH) + return getattr(settings, "STYLESHEET_PATH", fallbacks.STYLESHEET_PATH) def get_themes_from_css(): @@ -51,4 +51,4 @@ def get_theme_names(): def get_theme_default(): - return getattr(settings, "THEME_DEFAULT", default_htmx_settings.THEME_DEFAULT) + return getattr(settings, "THEME_DEFAULT", fallbacks.THEME_DEFAULT) From dfc22c0420eef1981a911e4f821498346e9dd35d Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 08:10:22 +0100 Subject: [PATCH 08/13] stop --- src/argus_htmx/checks.py | 2 +- src/argus_htmx/themes/utils.py | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/argus_htmx/checks.py b/src/argus_htmx/checks.py index e5ed5a62..b483d01c 100644 --- a/src/argus_htmx/checks.py +++ b/src/argus_htmx/checks.py @@ -9,7 +9,7 @@ def check_for_valid_themes_list(app_configs, **kwargs): errors = [] themes = [] try: - themes = get_theme_names() + themes = get_theme_names(quiet=False) except ImproperlyConfigured as e: errors.append( Error( diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 5be8fef8..59127778 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -1,9 +1,10 @@ -from importlib.resources import files +import logging from pathlib import Path from re import findall from django.conf import settings from django.core.exceptions import ImproperlyConfigured +from django.contrib.staticfiles.finders import find from argus_htmx import settings as fallbacks @@ -14,6 +15,9 @@ ] +LOG = logging.getLogger(__name__) + + def get_themes_from_setting(): themes_setting = getattr(settings, "DAISYUI_THEMES", fallbacks.DAISYUI_THEMES) theme_names = [] @@ -30,23 +34,28 @@ def get_stylesheet_path(): def get_themes_from_css(): - THEME_NAME_RE = "(?P\w+)" + THEME_NAME_RE = "(?P[-_]\w+)" DATA_THEME_RE = f"\[data-theme={THEME_NAME_RE}\]" - static_url = Path(settings.STATIC_URL).relative_to("/") - stylesheet_path = static_url / get_stylesheet_path() - styles_css = files("argus_htmx").joinpath(stylesheet_path).read_text() + absolute_stylesheet_path = Path(find(get_stylesheet_path())) + styles_css = absolute_stylesheet_path.read_text() return findall(DATA_THEME_RE, styles_css) -def get_theme_names(): +def get_theme_names(quiet=True): + ERROR_MSG = "Themes in settings are out of sync with themes installed" + themes_from_setting = set(get_themes_from_setting()) themes_from_css = set(get_themes_from_css()) - installed_themes = themes_from_setting | themes_from_css + installed_themes = themes_from_setting & themes_from_css + all_themes = themes_from_setting & themes_from_css if all_themes != installed_themes: - raise ImproperlyConfigured("Themes in settings is out of sync with themes installed") + LOG.warning(ERROR_MSG) + if not quiet: + raise ImproperlyConfigured(ERROR_MSG) + return installed_themes From 1a61478a5eb14cbe6bf02d2a82372001443029ff Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 08:22:23 +0100 Subject: [PATCH 09/13] stop --- src/argus_htmx/themes/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 59127778..81551995 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -34,7 +34,7 @@ def get_stylesheet_path(): def get_themes_from_css(): - THEME_NAME_RE = "(?P[-_]\w+)" + THEME_NAME_RE = "(?P[-_\w]+)" DATA_THEME_RE = f"\[data-theme={THEME_NAME_RE}\]" absolute_stylesheet_path = Path(find(get_stylesheet_path())) @@ -50,7 +50,7 @@ def get_theme_names(quiet=True): themes_from_css = set(get_themes_from_css()) installed_themes = themes_from_setting & themes_from_css - all_themes = themes_from_setting & themes_from_css + all_themes = themes_from_setting | themes_from_css if all_themes != installed_themes: LOG.warning(ERROR_MSG) if not quiet: From 095ffa16f765c3cdbeea0e2fa5a9452e746f4170 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 08:26:09 +0100 Subject: [PATCH 10/13] fix check --- src/argus_htmx/checks.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/argus_htmx/checks.py b/src/argus_htmx/checks.py index b483d01c..d4318886 100644 --- a/src/argus_htmx/checks.py +++ b/src/argus_htmx/checks.py @@ -1,4 +1,4 @@ -from django.core.checks import Error, register +from django.core.checks import Error, Warning, register from django.core.exceptions import ImproperlyConfigured from .themes.utils import get_theme_names @@ -6,25 +6,22 @@ @register def check_for_valid_themes_list(app_configs, **kwargs): - errors = [] themes = [] try: themes = get_theme_names(quiet=False) except ImproperlyConfigured as e: - errors.append( - Error( + return [ + Warning( str(e), hint="Regenerate styles.css", id="argus_htmx.T001", ) - ) - else: - if not themes: - errors.append( - Error( - "no themes installed", - hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate styles.css', - id="argus_htmx.T002", - ) + ] + if not themes: + return [ + Error( + "no themes installed", + hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate styles.css', + id="argus_htmx.T002", ) - return errors + ] From 89cde800d5edf91b52e71d59452feec4351badd0 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 09:31:39 +0100 Subject: [PATCH 11/13] fix as per review --- src/argus_htmx/checks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/argus_htmx/checks.py b/src/argus_htmx/checks.py index d4318886..28058904 100644 --- a/src/argus_htmx/checks.py +++ b/src/argus_htmx/checks.py @@ -1,11 +1,12 @@ from django.core.checks import Error, Warning, register from django.core.exceptions import ImproperlyConfigured -from .themes.utils import get_theme_names +from .themes.utils import get_theme_names, get_stylesheet_path @register def check_for_valid_themes_list(app_configs, **kwargs): + styles_path = get_stylesheet_path() themes = [] try: themes = get_theme_names(quiet=False) @@ -13,7 +14,7 @@ def check_for_valid_themes_list(app_configs, **kwargs): return [ Warning( str(e), - hint="Regenerate styles.css", + hint=f"Regenerate {styles_path}", id="argus_htmx.T001", ) ] @@ -21,7 +22,8 @@ def check_for_valid_themes_list(app_configs, **kwargs): return [ Error( "no themes installed", - hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate styles.css', + hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate {styles_path}', id="argus_htmx.T002", ) ] + return [] From 282d37b34a4f765e7e34d971df14892575d1a926 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 09:35:42 +0100 Subject: [PATCH 12/13] fix for tailwind_config mgmt cmd --- src/argus_htmx/management/commands/tailwind_config.py | 4 ++-- src/argus_htmx/themes/utils.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/argus_htmx/management/commands/tailwind_config.py b/src/argus_htmx/management/commands/tailwind_config.py index 0f4f68c1..a01d1408 100644 --- a/src/argus_htmx/management/commands/tailwind_config.py +++ b/src/argus_htmx/management/commands/tailwind_config.py @@ -8,7 +8,7 @@ from django.template.context import make_context from django.template.loader import get_template -from argus_htmx.themes.utils import get_themes +from argus_htmx.themes.utils import get_raw_themes_setting from argus_htmx import settings as argus_htmx_settings @@ -78,7 +78,7 @@ def get_context(self, target_dir: pathlib.Path): argus_htmx_settings.TAILWIND_THEME_OVERRIDE, ), "daisyuithemes": textwrap.indent( - json.dumps(get_themes(), indent=2), + json.dumps(get_raw_themes_setting(), indent=2), prefix=10 * " ", predicate=lambda line: line != "[\n", # this is kinda hacky, but eh ), diff --git a/src/argus_htmx/themes/utils.py b/src/argus_htmx/themes/utils.py index 81551995..2cecbdf2 100644 --- a/src/argus_htmx/themes/utils.py +++ b/src/argus_htmx/themes/utils.py @@ -10,6 +10,7 @@ __all__ = [ + "get_raw_themes_setting", "get_theme_names", "get_theme_default", ] @@ -18,8 +19,12 @@ LOG = logging.getLogger(__name__) +def get_raw_themes_setting(): + return getattr(settings, "DAISYUI_THEMES", fallbacks.DAISYUI_THEMES) + + def get_themes_from_setting(): - themes_setting = getattr(settings, "DAISYUI_THEMES", fallbacks.DAISYUI_THEMES) + themes_setting = get_raw_themes_setting() theme_names = [] for theme in themes_setting: if isinstance(theme, str): From 477a2dcdaf8e886af7307988c6b38ab3a16b13ae Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 14 Nov 2024 09:45:49 +0100 Subject: [PATCH 13/13] blbl --- src/argus_htmx/checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/argus_htmx/checks.py b/src/argus_htmx/checks.py index 28058904..6e55ad10 100644 --- a/src/argus_htmx/checks.py +++ b/src/argus_htmx/checks.py @@ -22,7 +22,7 @@ def check_for_valid_themes_list(app_configs, **kwargs): return [ Error( "no themes installed", - hint='Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate {styles_path}', + hint=f'Check the settings "DAISYUI_THEMES" and "TAILWIND_THEME_OVERRIDE" and regenerate {styles_path}', id="argus_htmx.T002", ) ]