Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add default currency context processors
Michal Ociepka0c22e759a40a
diff --git a/saleor/context_processors.py b/saleor/context_processors.pyindex 0dfb363a7a..b1d075c1af 100644--- a/saleor/context_processors.py+++ b/saleor/context_processors.py@@ -1,15 +1,21 @@from django.conf import settings-def googe_analytics(request):+def get_setting_as_dict(name, short_name=None):+ short_name = short_name or nametry:- return {'GOOGLE_ANALYTICS_CODE': settings.GOOGLE_ANALYTICS_CODE}+ return {short_name: getattr(settings, name)}except AttributeError:return {}+def googe_analytics(request):+ return get_setting_as_dict('GOOGLE_ANALYTICS_CODE')+def canonical_hostname(request):- try:- return {'CANONICAL_HOSTNAME': settings.CANONICAL_HOSTNAME}- except AttributeError:- return {}+ return get_setting_as_dict('CANONICAL_HOSTNAME')+++def default_currency(request):+ return get_setting_as_dict('SATCHLESS_DEFAULT_CURRENCY',+ 'DEFAULT_CURRENCY')diff --git a/saleor/settings.py b/saleor/settings.pyindex cbf8b2527d..28d65f22d0 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -77,6 +77,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ['django.core.context_processors.request','saleor.context_processors.googe_analytics','saleor.context_processors.canonical_hostname',+ 'saleor.context_processors.default_currency',]INSTALLED_APPS = [