Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve template tags naming
Anna Siwika1b22c795d46
diff --git a/saleor/dashboard/category/views.py b/saleor/dashboard/category/views.pyindex b9c1403d90..458dff232a 100644--- a/saleor/dashboard/category/views.py+++ b/saleor/dashboard/category/views.py@@ -23,7 +23,7 @@ def category_list(request):category_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'categories': categories, 'filter': category_filter,+ 'categories': categories, 'filter_set': category_filter,'is_empty': not category_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/category/list.html', ctx)@@ -90,7 +90,7 @@ def category_detail(request, pk):category_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {'categories': categories, 'path': path, 'root': root,- 'filter': category_filter,+ 'filter_set': category_filter,'is_empty': not category_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/category/detail.html', ctx)diff --git a/saleor/dashboard/customer/views.py b/saleor/dashboard/customer/views.pyindex 17f967a326..974c9feca8 100644--- a/saleor/dashboard/customer/views.py+++ b/saleor/dashboard/customer/views.py@@ -24,7 +24,7 @@ def customer_list(request):customer_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'customers': customers, 'filter': customer_filter,+ 'customers': customers, 'filter_set': customer_filter,'is_empty': not customer_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/customer/list.html', ctx)diff --git a/saleor/dashboard/discount/views.py b/saleor/dashboard/discount/views.pyindex 22a9cacc07..b99f09a299 100644--- a/saleor/dashboard/discount/views.py+++ b/saleor/dashboard/discount/views.py@@ -21,7 +21,7 @@ def sale_list(request):sale_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'sales': sales, 'filter': sale_filter,+ 'sales': sales, 'filter_set': sale_filter,'is_empty': not sale_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/discount/sale/list.html', ctx)@@ -67,7 +67,7 @@ def voucher_list(request):voucher_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'vouchers': vouchers, 'filter': voucher_filter,+ 'vouchers': vouchers, 'filter_set': voucher_filter,'is_empty': not voucher_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/discount/voucher/list.html', ctx)diff --git a/saleor/dashboard/group/views.py b/saleor/dashboard/group/views.pyindex fbe38be5da..a4e40a84a9 100644--- a/saleor/dashboard/group/views.py+++ b/saleor/dashboard/group/views.py@@ -23,7 +23,7 @@ def group_list(request):groups = get_paginator_items(groups, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))ctx = {- 'groups': groups, 'filter': group_filter,+ 'groups': groups, 'filter_set': group_filter,'is_empty': not group_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/group/list.html', ctx)diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex f03c9eb9f3..9adaa07fa6 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -38,7 +38,7 @@ def order_list(request):order_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'orders': orders, 'filter': order_filter,+ 'orders': orders, 'filter_set': order_filter,'is_empty': not order_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/order/list.html', ctx)diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.pyindex 7f2b168ecb..3591ffa896 100644--- a/saleor/dashboard/product/views.py+++ b/saleor/dashboard/product/views.py@@ -39,7 +39,7 @@ def product_class_list(request):pc.variant_attributes.all())for pc in classes.object_list]ctx = {- 'form': form, 'product_classes': classes, 'filter': class_filter,+ 'form': form, 'product_classes': classes, 'filter_set': class_filter,'is_empty': not class_filter.queryset.exists()}return TemplateResponse(request,@@ -120,7 +120,7 @@ def product_list(request):ctx = {'bulk_action_form': forms.ProductBulkUpdate(),'products': products, 'product_classes': product_classes,- 'filter': product_filter,+ 'filter_set': product_filter,'is_empty': not product_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/product/list.html', ctx)@@ -497,7 +497,7 @@ def attribute_list(request):attributes = get_paginator_items(attributes, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))ctx = {- 'attributes': attributes, 'filter': attribute_filter,+ 'attributes': attributes, 'filter_set': attribute_filter,'is_empty': not attribute_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/product/product_attribute/list.html', ctx)@@ -609,7 +609,7 @@ def stock_location_list(request):stock_location_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'locations': stock_locations, 'filter': stock_location_filter,+ 'locations': stock_locations, 'filter_set': stock_location_filter,'is_empty': not stock_location_filter.queryset.exists()}return TemplateResponse(request,diff --git a/saleor/dashboard/shipping/views.py b/saleor/dashboard/shipping/views.pyindex d392e6cc73..c38e1749ba 100644--- a/saleor/dashboard/shipping/views.py+++ b/saleor/dashboard/shipping/views.py@@ -23,7 +23,7 @@ def shipping_method_list(request):shipping_method_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'shipping_methods': methods, 'filter': shipping_method_filter,+ 'shipping_methods': methods, 'filter_set': shipping_method_filter,'is_empty': not shipping_method_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/shipping/list.html', ctx)diff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.pyindex 575508a521..cbfa810324 100644--- a/saleor/dashboard/staff/views.py+++ b/saleor/dashboard/staff/views.py@@ -23,7 +23,7 @@ def staff_list(request):staff_filter.qs, settings.DASHBOARD_PAGINATE_BY,request.GET.get('page'))ctx = {- 'staff': staff_members, 'filter': staff_filter,+ 'staff': staff_members, 'filter_set': staff_filter,'is_empty': not staff_filter.queryset.exists()}return TemplateResponse(request, 'dashboard/staff/list.html', ctx)diff --git a/saleor/dashboard/templatetags/utils.py b/saleor/dashboard/templatetags/utils.pyindex 9f868f0175..4d0a60ceba 100644--- a/saleor/dashboard/templatetags/utils.py+++ b/saleor/dashboard/templatetags/utils.py@@ -77,7 +77,7 @@ def margins_for_variant(variant):@register.inclusion_tag('dashboard/includes/_filters.html', takes_context=True)-def add_filters(context, filter_set, sort_by_filter_name='sort_by'):+def filters(context, filter_set, sort_by_filter_name='sort_by'):"""Rendering filters template based on FilterSet."""chips = []request_get = context['request'].GET.copy()@@ -120,7 +120,7 @@ def serialize_messages(context):@register.inclusion_tag('dashboard/includes/_sorting_header.html', takes_context=True)-def render_sorting_header(context, field, label, is_wide=False):+def sorting_header(context, field, label, is_wide=False):"""This template tag renders table sorting header."""request = context['request']request_get = request.GET.copy()diff --git a/saleor/product/views.py b/saleor/product/views.pyindex 8d5e20d130..485326b7ab 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -125,7 +125,7 @@ def category_index(request, path, category_id):now_sorted_by = get_now_sorted_by(product_filter)arg_sort_by = request.GET.get('sort_by')is_descending = arg_sort_by.startswith('-') if arg_sort_by else False- ctx = {'category': category, 'filter': product_filter,+ ctx = {'category': category, 'filter_set': product_filter,'products': products_and_availability,'products_paginated': products_paginated,'sort_by_choices': get_sort_by_choices(product_filter),diff --git a/templates/dashboard/category/detail.html b/templates/dashboard/category/detail.htmlindex 353e3c153b..58eddc59cb 100644--- a/templates/dashboard/category/detail.html+++ b/templates/dashboard/category/detail.html@@ -133,10 +133,10 @@<thead><tr>{% trans "Name" context "Category list table header name" as label %}- {% render_sorting_header 'name' label %}+ {% sorting_header 'name' label %}{% trans "Description" context "Category list table header description" as label %}- {% render_sorting_header 'description' label is_wide=True %}+ {% sorting_header 'description' label is_wide=True %}{% if perms.product.edit_category %}<th></th>@@ -181,7 +181,7 @@{% paginate categories %}</div><div class="col s12 l3" id="filters">- {% add_filters filter %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endif %}diff --git a/templates/dashboard/category/list.html b/templates/dashboard/category/list.htmlindex 5400362f09..90ee573e73 100644--- a/templates/dashboard/category/list.html+++ b/templates/dashboard/category/list.html@@ -51,10 +51,10 @@<thead><tr>{% trans "Name" context "Category list table header name" as label %}- {% render_sorting_header 'name' label %}+ {% sorting_header 'name' label %}{% trans "Description" context "Category list table header description" as label %}- {% render_sorting_header 'description' label is_wide=True %}+ {% sorting_header 'description' label is_wide=True %}</tr></thead><tbody>@@ -92,7 +92,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/customer/list.html b/templates/dashboard/customer/list.htmlindex 080c4a755c..c81571875b 100644--- a/templates/dashboard/customer/list.html+++ b/templates/dashboard/customer/list.html@@ -30,13 +30,13 @@<thead><tr>{% trans "Name" context "Customers table header" as label %}- {% render_sorting_header 'name' label %}+ {% sorting_header 'name' label %}{% trans "Email" context "Customers table header" as label %}- {% render_sorting_header 'email' label %}+ {% sorting_header 'email' label %}{% trans "Location" context "Customers table header" as label %}- {% render_sorting_header 'location' label %}+ {% sorting_header 'location' label %}</tr></thead><tbody>@@ -83,7 +83,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/discount/sale/list.html b/templates/dashboard/discount/sale/list.htmlindex c8076f2829..57c5ae0ddb 100644--- a/templates/dashboard/discount/sale/list.html+++ b/templates/dashboard/discount/sale/list.html@@ -43,10 +43,10 @@<thead><tr>{% trans "Name" context "Sale (discount) table header" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}{% trans "Discount" context "Sale (discount) table header" as label %}- {% render_sorting_header 'value' label is_wide=True %}+ {% sorting_header 'value' label is_wide=True %}</tr></thead><tbody>@@ -80,7 +80,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/discount/voucher/list.html b/templates/dashboard/discount/voucher/list.htmlindex 993f4f629f..de6b890856 100644--- a/templates/dashboard/discount/voucher/list.html+++ b/templates/dashboard/discount/voucher/list.html@@ -44,26 +44,26 @@<thead><tr>{% trans "Name" context "Voucher table header" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}{% trans "Discount" context "Voucher table header" as label %}- {% render_sorting_header 'discount_value' label is_wide=True %}+ {% sorting_header 'discount_value' label is_wide=True %}<th>{% trans "Apply to" context "Voucher table header" %}</th>{% trans "Start date" context "Voucher table header" as label %}- {% render_sorting_header 'start_date' label is_wide=True %}+ {% sorting_header 'start_date' label is_wide=True %}{% trans "End date" context "Voucher table header" as label %}- {% render_sorting_header 'end_date' label is_wide=True %}+ {% sorting_header 'end_date' label is_wide=True %}{% trans "Used" context "Voucher table header" as label %}- {% render_sorting_header 'used' label is_wide=True %}+ {% sorting_header 'used' label is_wide=True %}{% trans "Limit" context "Voucher table header" as label %}- {% render_sorting_header 'limit' label is_wide=True %}+ {% sorting_header 'limit' label is_wide=True %}</tr></thead>{% for voucher in vouchers %}@@ -120,7 +120,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/group/list.html b/templates/dashboard/group/list.htmlindex 52818b5b23..62ed35f39a 100644--- a/templates/dashboard/group/list.html+++ b/templates/dashboard/group/list.html@@ -43,7 +43,7 @@<thead><tr>{% trans "Name" context "Dashboard groups list table header name" as label %}- {% render_sorting_header 'name' label %}+ {% sorting_header 'name' label %}<th>{% trans "Permissions" context "Dashboard groups list table header permissions" %}</th>@@ -82,7 +82,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/includes/_orders_table.html b/templates/dashboard/includes/_orders_table.htmlindex 3d5f327447..f775e2b6c6 100644--- a/templates/dashboard/includes/_orders_table.html+++ b/templates/dashboard/includes/_orders_table.html@@ -6,21 +6,21 @@<table class="bordered highlight responsive data-table last-right-align"><thead><tr>- {% render_sorting_header 'pk' '#' %}+ {% sorting_header 'pk' '#' %}<th></th>{% trans "Customer" context "Orders table header" as label %}- {% render_sorting_header 'email' label %}+ {% sorting_header 'email' label %}{% trans "Placed on" context "Orders table header" as label %}- {% render_sorting_header 'created' label %}+ {% sorting_header 'created' label %}{% trans "Payment status" context "Orders table header" as label %}- {% render_sorting_header 'payment_status' label %}+ {% sorting_header 'payment_status' label %}{% trans "Total" context "Orders table header" as label %}- {% render_sorting_header 'total' label %}+ {% sorting_header 'total' label %}</tr></thead><tbody>diff --git a/templates/dashboard/order/list.html b/templates/dashboard/order/list.htmlindex 40cbef0f1a..12c413c42b 100644--- a/templates/dashboard/order/list.html+++ b/templates/dashboard/order/list.html@@ -41,7 +41,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/product/list.html b/templates/dashboard/product/list.htmlindex d6ee41b28b..105ae2385d 100644--- a/templates/dashboard/product/list.html+++ b/templates/dashboard/product/list.html@@ -74,10 +74,10 @@</th><th></th>{% trans "Name" context "Products list table header" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}{% trans "Price" context "Products list table header" as label %}- {% render_sorting_header 'price' label is_wide=True %}+ {% sorting_header 'price' label is_wide=True %}</tr></thead><tbody>@@ -121,7 +121,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/product/product_attribute/list.html b/templates/dashboard/product/product_attribute/list.htmlindex 1ab5f5f44d..5e3344d3d7 100644--- a/templates/dashboard/product/product_attribute/list.html+++ b/templates/dashboard/product/product_attribute/list.html@@ -42,7 +42,7 @@<thead><tr>{% trans "Name" context "Dashboard attributes list table header name" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}<th>{% trans "Values" context "Dashboard attributes list table header values" %}</th>@@ -79,7 +79,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/product/product_class/list.html b/templates/dashboard/product/product_class/list.htmlindex c3b5d2b790..0b7e64f0d2 100644--- a/templates/dashboard/product/product_class/list.html+++ b/templates/dashboard/product/product_class/list.html@@ -43,7 +43,7 @@<thead><tr>{% trans "Name" context "Dashboard product types list table header name" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}<th>{% trans "Product attributes" context "Product type item list text" %}@@ -95,7 +95,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div><div id="modal-product-class" class="modal">diff --git a/templates/dashboard/product/stock_location/list.html b/templates/dashboard/product/stock_location/list.htmlindex 3763a4ddb4..a2ac058a0a 100644--- a/templates/dashboard/product/stock_location/list.html+++ b/templates/dashboard/product/stock_location/list.html@@ -40,7 +40,7 @@<thead><tr>{% trans "Name" context "Dashboard stock location table header name" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}</tr></thead><tbody>diff --git a/templates/dashboard/shipping/list.html b/templates/dashboard/shipping/list.htmlindex b9e5fcae8c..3d70350ade 100644--- a/templates/dashboard/shipping/list.html+++ b/templates/dashboard/shipping/list.html@@ -43,7 +43,7 @@<thead><tr>{% trans "Name" context "Shipping methods table header" as label %}- {% render_sorting_header 'name' label is_wide=True %}+ {% sorting_header 'name' label is_wide=True %}<th>{% trans "Price range" context "Shipping methods table header" %}@@ -93,7 +93,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/templates/dashboard/staff/list.html b/templates/dashboard/staff/list.htmlindex 8e07294aa3..932605dcac 100644--- a/templates/dashboard/staff/list.html+++ b/templates/dashboard/staff/list.html@@ -43,13 +43,13 @@<thead><tr>{% trans "Name" context "Staff members table header" as label %}- {% render_sorting_header 'name' label %}+ {% sorting_header 'name' label %}{% trans "Email" context "Staff members table header" as label %}- {% render_sorting_header 'email' label %}+ {% sorting_header 'email' label %}{% trans "Location" context "Staff members table header" as label %}- {% render_sorting_header 'location' label %}+ {% sorting_header 'location' label %}</tr></thead><tbody>@@ -96,7 +96,7 @@{% endif %}</div><div class="col s12 l3" id="filters">- {% if not is_empty %}{% add_filters filter %}{% endif %}+ {% if not is_empty %}{% filters filter_set %}{% endif %}</div></div>{% endblock %}diff --git a/tests/dashboard/test_product.py b/tests/dashboard/test_product.pyindex 978ff70609..f3a6bdedd9 100644--- a/tests/dashboard/test_product.py+++ b/tests/dashboard/test_product.py@@ -544,7 +544,7 @@ def test_product_list_filters(admin_client, product_list):url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert list(response.context['filter'].qs) == product_list+ assert list(response.context['filter_set'].qs) == product_listdef test_product_list_filters_sort_by(admin_client, product_list):@@ -553,14 +553,14 @@ def test_product_list_filters_sort_by(admin_client, product_list):url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert list(response.context['filter'].qs) == product_list+ assert list(response.context['filter_set'].qs) == product_listdata = {'price_1': [''], 'price_0': [''], 'is_featured': [''],'name': ['Test'], 'sort_by': ['-name'], 'is_published': ['']}url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert list(response.context['filter'].qs) == product_list[::-1]+ assert list(response.context['filter_set'].qs) == product_list[::-1]def test_product_list_filters_is_published(@@ -571,7 +571,7 @@ def test_product_list_filters_is_published(url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- result = list(response.context['filter'].qs)+ result = list(response.context['filter_set'].qs)assert result == [product_list[0], product_list[2]]@@ -582,7 +582,7 @@ def test_product_list_filters_no_results(admin_client, product_list):url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert list(response.context['filter'].qs) == []+ assert list(response.context['filter_set'].qs) == []def test_product_list_pagination(admin_client, product_list):@@ -591,13 +591,13 @@ def test_product_list_pagination(admin_client, product_list):url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert not response.context['filter'].is_bound_unsorted+ assert not response.context['filter_set'].is_bound_unsorteddata = {'page': '2'}url = reverse('dashboard:product-list')response = admin_client.get(url, data)assert response.status_code == 200- assert not response.context['filter'].is_bound_unsorted+ assert not response.context['filter_set'].is_bound_unsorteddef test_product_list_pagination_with_filters(admin_client, product_list):diff --git a/tests/dashboard/test_templatetags.py b/tests/dashboard/test_templatetags.pyindex 965bf3a774..d5e075f1ea 100644--- a/tests/dashboard/test_templatetags.py+++ b/tests/dashboard/test_templatetags.py@@ -2,43 +2,43 @@ import pytestfrom django.urls import reverse-from saleor.dashboard.templatetags.utils import render_sorting_header+from saleor.dashboard.templatetags.utils import sorting_header-def test_render_sorting_header_prepare_initial_data(admin_client):+def test_sorting_header_prepare_initial_data(admin_client):url = reverse('dashboard:product-list')response = admin_client.get(url)- result = render_sorting_header(response.context, 'name', 'Name')+ result = sorting_header(response.context, 'name', 'Name')assert result['url'] == url + '?sort_by=name'assert result['is_active'] == Falseassert result['sorting_icon'] == ''-def test_render_sorting_header_name_field(admin_client):+def test_sorting_header_name_field(admin_client):url = reverse('dashboard:product-list')data = {'sort_by': 'name'}response = admin_client.get(url, data)- result = render_sorting_header(response.context, 'name', 'Name')+ result = sorting_header(response.context, 'name', 'Name')assert result['url'] == url + '?sort_by=-name'assert result['is_active'] == Truedata = {'sort_by': '-name'}response = admin_client.get(url, data)- result = render_sorting_header(response.context, 'name', 'Name')+ result = sorting_header(response.context, 'name', 'Name')assert result['url'] == url + '?sort_by=name'assert result['is_active'] == True-def test_render_sorting_header_many_fields(admin_client):+def test_sorting_header_many_fields(admin_client):url = reverse('dashboard:product-list')data = {'sort_by': 'name'}response = admin_client.get(url, data)- result = render_sorting_header(response.context, 'name', 'Name')+ result = sorting_header(response.context, 'name', 'Name')assert result['url'] == url + '?sort_by=-name'assert result['is_active'] == Truedata = {'sort_by': 'price'}response = admin_client.get(url, data)- result = render_sorting_header(response.context, 'price', 'Price')+ result = sorting_header(response.context, 'price', 'Price')assert result['url'] == url + '?sort_by=-price'assert result['is_active'] == Truediff --git a/tests/test_product.py b/tests/test_product.pyindex 2535e40bfa..91272feac2 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -381,7 +381,7 @@ def test_product_filter_before_filtering('product:category', kwargs={'path': default_category.slug,'category_id': default_category.pk})response = authorized_client.get(url)- assert list(products) == list(response.context['filter'].qs)+ assert list(products) == list(response.context['filter_set'].qs)def test_product_filter_product_exists(authorized_client, product_in_stock,@@ -394,17 +394,17 @@ def test_product_filter_product_exists(authorized_client, product_in_stock,'category_id': default_category.pk})data = {'price_0': [''], 'price_1': ['20']}response = authorized_client.get(url, data)- assert list(response.context['filter'].qs) == list(products)+ assert list(response.context['filter_set'].qs) == list(products)-def test_product_filter_product_does_not_exists(+def test_product_filter_product_does_not_exist(authorized_client, product_in_stock, default_category):url = reverse('product:category', kwargs={'path': default_category.slug,'category_id': default_category.pk})data = {'price_0': ['20'], 'price_1': ['']}response = authorized_client.get(url, data)- assert not list(response.context['filter'].qs)+ assert not list(response.context['filter_set'].qs)def test_product_filter_form(authorized_client, product_in_stock,@@ -416,9 +416,9 @@ def test_product_filter_form(authorized_client, product_in_stock,'product:category', kwargs={'path': default_category.slug,'category_id': default_category.pk})response = authorized_client.get(url)- assert 'price' in response.context['filter'].form.fields.keys()- assert 'sort_by' in response.context['filter'].form.fields.keys()- assert list(response.context['filter'].qs) == list(products)+ assert 'price' in response.context['filter_set'].form.fields.keys()+ assert 'sort_by' in response.context['filter_set'].form.fields.keys()+ assert list(response.context['filter_set'].qs) == list(products)def test_product_filter_sorted_by_price_descending(@@ -431,7 +431,7 @@ def test_product_filter_sorted_by_price_descending('category_id': default_category.pk})data = {'sort_by': '-price'}response = authorized_client.get(url, data)- assert list(response.context['filter'].qs) == list(products)+ assert list(response.context['filter_set'].qs) == list(products)def test_product_filter_sorted_by_wrong_parameter(@@ -441,7 +441,7 @@ def test_product_filter_sorted_by_wrong_parameter('category_id': default_category.pk})data = {'sort_by': 'aaa'}response = authorized_client.get(url, data)- assert not list(response.context['filter'].qs)+ assert not list(response.context['filter_set'].qs)def test_get_variant_picker_data_proper_variant_count(product_in_stock):