Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add feed file url getter

Krzysztof Wolski1a2a147e993b
diff --git a/saleor/data_feeds/google_merchant.py b/saleor/data_feeds/google_merchant.py
index fbed7d314f..77eb0f4071 100644
--- a/saleor/data_feeds/google_merchant.py
+++ b/saleor/data_feeds/google_merchant.py
@@ -16,7 +16,6 @@ from ..product.models import ProductVariant, Category
CATEGORY_SEPARATOR = ' > '
FILE_PATH = 'google-feed.csv.gz'
-FILE_URL = default_storage.url(FILE_PATH)
ATTRIBUTES = ['id', 'title', 'product_type', 'google_product_category',
'link', 'image_link', 'condition', 'availability',
@@ -24,6 +23,10 @@ ATTRIBUTES = ['id', 'title', 'product_type', 'google_product_category',
'gender', 'age_group', 'color', 'size', 'description']
+def get_feed_file_url():
+ return default_storage.url(FILE_PATH)
+
+
def get_feed_items():
items = ProductVariant.objects.all()
items = items.select_related('product')
diff --git a/saleor/data_feeds/urls.py b/saleor/data_feeds/urls.py
index b789eae4f2..3034bad34d 100644
--- a/saleor/data_feeds/urls.py
+++ b/saleor/data_feeds/urls.py
@@ -1,8 +1,8 @@
from django.conf.urls import url
from django.views.generic.base import RedirectView
-from .google_merchant import FILE_URL
+from .google_merchant import get_feed_file_url
urlpatterns = [
- url(r'google/$',
- RedirectView.as_view(url=FILE_URL), name='google-feed')]
+ url(r'google/$', RedirectView.as_view(
+ get_redirect_url=get_feed_file_url), name='google-feed')]