Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Reverted quantity field to DecimalField, overrided type of field in single product forms
Artur Smęt6cecf241ea5d
diff --git a/saleor/cart/forms.py b/saleor/cart/forms.pyindex 99e350879f..bc938d2701 100644--- a/saleor/cart/forms.py+++ b/saleor/cart/forms.py@@ -7,12 +7,12 @@ from django.utils.translation import pgettext, ugettextfrom satchless.item import InsufficientStock-class QuantityField(forms.IntegerField):+class QuantityField(forms.DecimalField):def __init__(self, *args, **kwargs):super(QuantityField, self).__init__(- *args, max_value=None, min_value=0,- initial=1, **kwargs)+ *args, max_value=None, min_value=Decimal(0), max_digits=10,+ decimal_places=4, initial=Decimal(1), **kwargs)class AddToCartForm(forms.Form):diff --git a/saleor/product/forms.py b/saleor/product/forms.pyindex 350da206fd..067c476b3b 100644--- a/saleor/product/forms.py+++ b/saleor/product/forms.py@@ -5,6 +5,7 @@ from .models import Bag, BagVariant, Shirt, ShirtVariant, Colorclass BagForm(AddToCartForm):+ quantity = forms.IntegerField(initial=1)def get_variant(self, clean_data):return BagVariant.objects.get(product__color=self.product.color)@@ -14,6 +15,7 @@ class ShirtForm(AddToCartForm):size = forms.ChoiceField(choices=ShirtVariant.SIZE_CHOICES,widget=forms.RadioSelect())+ quantity = forms.IntegerField(initial=1)def __init__(self, *args, **kwargs):super(ShirtForm, self).__init__(*args, **kwargs)