Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Create settings if not found
Krzysztof Wolski86e4808dbb73
diff --git a/saleor/site/utils.py b/saleor/site/utils.pyindex f5720d5610..1bf906208c 100644--- a/saleor/site/utils.py+++ b/saleor/site/utils.py@@ -17,4 +17,4 @@ def get_site_settings(request):def get_site_settings_uncached(settings_id=None):# type: (str) -> SiteSettings"""Query database for settings object."""- return SiteSettings.objects.get(pk=settings_id)+ return SiteSettings.objects.get_or_create(pk=settings_id)[0]diff --git a/tests/test_site_settings.py b/tests/test_site_settings.pyindex b4226a544b..c338c7c234 100644--- a/tests/test_site_settings.py+++ b/tests/test_site_settings.py@@ -6,7 +6,6 @@ from django.utils.encoding import smart_textfrom saleor.site.models import SiteSettingsfrom saleor.site import utilsfrom saleor.dashboard.sites.forms import SiteSettingForm-from .utils import get_redirect_location@pytest.fixture