Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Review fixes
michal722b50e551d4
diff --git a/saleor/product/filters.py b/saleor/product/filters.pyindex 425de924dd..9069bfd6ef 100644--- a/saleor/product/filters.py+++ b/saleor/product/filters.py@@ -77,6 +77,6 @@ class ProductFilter(FilterSet):return [(choice.pk, choice.name) for choice in attribute.values.all()]-def get_prepared_choices(filter):+def get_sort_by_choices(filter):return [(choice[0], choice[1].lower()) for choice infilter.filters['sort_by'].field.choices[1::2]]diff --git a/saleor/product/views.py b/saleor/product/views.pyindex eb548032c8..f0a0ca9186 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -9,8 +9,7 @@ from django.shortcuts import get_object_or_404, redirectfrom django.template.response import TemplateResponsefrom django.utils.translation import pgettext_lazy-from saleor.product.filters import get_prepared_choices-from .filters import DEFAULT_SORT, ProductFilter+from .filters import DEFAULT_SORT, ProductFilter, get_sort_by_choicesfrom .models import Categoryfrom .utils import (products_with_details, products_for_cart,handle_cart_form, get_availability,@@ -133,7 +132,7 @@ def category_index(request, path, category_id):ctx = {'category': category, 'filter': product_filter,'products': products_and_availability,'products_paginated': products_paginated,- 'sort_by_choices': get_prepared_choices(product_filter),+ 'sort_by_choices': get_sort_by_choices(product_filter),'now_sorted_by': pgettext_lazy('Product field', sort_by.strip('-')),'is_descending': sort_by.startswith('-')}