Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Always render product class choices as radio buttons
Marcin Gębala4f8683137376
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 571df8952d..445a657e97 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -8,27 +8,22 @@ from django.utils.encoding import smart_textfrom django.utils.text import slugifyfrom django.utils.translation import pgettext_lazy-from ...product.models import (AttributeChoiceValue, Product, ProductAttribute,- ProductClass, ProductImage, ProductVariant,- Stock, StockLocation, VariantImage)+from ...product.models import (+ AttributeChoiceValue, Product, ProductAttribute, ProductClass,+ ProductImage, ProductVariant, Stock, StockLocation, VariantImage)from .widgets import ImagePreviewWidgetfrom ...search import index as search_indexclass ProductClassSelectorForm(forms.Form):- MAX_RADIO_SELECT_ITEMS = 5def __init__(self, *args, **kwargs):product_classes = kwargs.pop('product_classes', [])super(ProductClassSelectorForm, self).__init__(*args, **kwargs)choices = [(obj.pk, obj.name) for obj in product_classes]- if len(product_classes) > self.MAX_RADIO_SELECT_ITEMS:- widget = forms.Select- else:- widget = forms.RadioSelectself.fields['product_cls'] = forms.ChoiceField(label=pgettext_lazy('Product class form label', 'Product type'),- choices=choices, widget=widget)+ choices=choices, widget=forms.RadioSelect)class StockForm(forms.ModelForm):