Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Return attribute choice object instead of string
Marcin Gębala82f578e7b93d
diff --git a/saleor/product/forms.py b/saleor/product/forms.pyindex e04add0a2d..927176eca8 100644--- a/saleor/product/forms.py+++ b/saleor/product/forms.py@@ -19,7 +19,7 @@ class VariantChoiceIterator(ModelChoiceIterator):def choice(self, obj):if self.product:values = get_attributes_display(obj, self.attributes).values()- label = ', '.join(values)+ label = ', '.join([str(value) for value in values])else:label = self.field.label_from_instance(obj)label += ' - ' + gross(obj.get_price())diff --git a/saleor/product/utils.py b/saleor/product/utils.pyindex 8972e31ff3..e6323047fe 100644--- a/saleor/product/utils.py+++ b/saleor/product/utils.py@@ -13,5 +13,5 @@ def get_attributes_display(variant, attributes):except ValueError:display[attribute.pk] = valueelse:- display[attribute.pk] = choice.display+ display[attribute.pk] = choicereturn display