diff --git a/setty/context_processors.py b/setty/context_processors.py index c27b4de..fcce546 100644 --- a/setty/context_processors.py +++ b/setty/context_processors.py @@ -1,4 +1,6 @@ import setty +from django.conf import settings +from django.urls import resolve def setty_settings(request): @@ -8,7 +10,10 @@ def setty_settings(request): Add 'setty.context_processors.setty_settings' to the TEMPLATE_CONTEXT_PROCESSORS setting to ensure this can be used. """ - tags = {f'setty_{app}': setty.config.get_for_app(app) for app in settings.INSTALLED_APPS} - tags['setty'] = setty.config + + tags = {'setty': setty.config} + app_name = resolve(request.path).app_name + if app_name: + tags['setty_current_app'] = setty.config.get_for_app(app_name) return tags diff --git a/setty/wrapper.py b/setty/wrapper.py index b32cd7b..398b09a 100644 --- a/setty/wrapper.py +++ b/setty/wrapper.py @@ -29,4 +29,4 @@ def __dir__(self): return [setting.name for setting in self._backend.get_all()] def get_for_app(self, app_name): - return {setting.name: setting.value for setting in self._backend.get_all(app_name)} + return [setting for setting in self._backend.get_all(app_name)]