From 5f1f8d0ea176ade2259b0ec80121f469b5653622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 1 Jan 2018 15:30:55 +0100 Subject: [PATCH 2/3] theme: lazy load Variable model (#20933) So the module can be used outside of Hobo. --- hobo/theme/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hobo/theme/utils.py b/hobo/theme/utils.py index d1fa7d9..8984b21 100644 --- a/hobo/theme/utils.py +++ b/hobo/theme/utils.py @@ -19,8 +19,6 @@ import os from django.conf import settings -from hobo.environment.models import Variable - def get_themes(): themes = [] @@ -41,6 +39,7 @@ def get_themes(): return themes def get_selected_theme(): + from hobo.environment.models import Variable try: selected_theme = Variable.objects.get(name='theme', service_pk__isnull=True).value except Variable.DoesNotExist: @@ -48,6 +47,7 @@ def get_selected_theme(): return selected_theme def set_theme(theme_id): + from hobo.environment.models import Variable selected_theme, created = Variable.objects.get_or_create( name='theme', service_pk__isnull=True) -- 2.15.1