Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use SiteSettings instead of Site
Krzysztof Wolski2ab636daf13d
diff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.pyindex 9d47eee64b..940c3313be 100644--- a/saleor/core/utils/__init__.py+++ b/saleor/core/utils/__init__.py@@ -15,6 +15,7 @@ from geolite2 import geolite2from prices import PriceRangefrom ...userprofile.models import User+from ...site.utils import get_site_settingstry:from urllib.parse import urljoin@@ -40,8 +41,7 @@ class CategoryChoiceField(forms.ModelChoiceField):def build_absolute_uri(location, is_secure=False):- from django.contrib.sites.models import Site- site = Site.objects.get_current()+ site = get_site_settings()host = site.domaincurrent_uri = '%s://%s' % ('https' if is_secure else 'http', host)location = urljoin(current_uri, location)diff --git a/saleor/product/views.py b/saleor/product/views.pyindex 3a861fcc22..a6c56340cc 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -80,6 +80,8 @@ def product_details(request, slug, product_id, form=None):def product_add_to_cart(request, slug, product_id):+ # types: (int, str, dict) -> None+if not request.method == 'POST':return redirect(reverse('product:details',diff --git a/tests/test_data_feeds.py b/tests/test_data_feeds.pyindex ab853beb73..e1a95b5051 100644--- a/tests/test_data_feeds.py+++ b/tests/test_data_feeds.py@@ -4,7 +4,6 @@ import csvfrom mock import Mock-from django.contrib.sites.models import Sitefrom django.utils import sixfrom django.utils.encoding import smart_textif six.PY3:@@ -17,6 +16,7 @@ from saleor.data_feeds.google_merchant import (get_feed_items,item_attributes,item_google_product_category,write_feed)+from saleor.site.utils import get_site_settingsdef test_saleor_feed_items(product_in_stock):@@ -27,7 +27,7 @@ def test_saleor_feed_items(product_in_stock):discounts = []category_paths = {}attributes_dict = {}- current_site = Site.objects.get_current()+ current_site = get_site_settings()attribute_values_dict = {smart_text(a.pk): smart_text(a) for ain AttributeChoiceValue.objects.all()}attributes = item_attributes(items[0], categories, category_paths,