Skip to content

Saleor Core: the high performance, composable, headless commerce API.

QuantityField as IntegerField

Artur Smętf9f518f152cb
diff --git a/saleor/cart/forms.py b/saleor/cart/forms.py
index cf9257f215..270d48665e 100644
--- a/saleor/cart/forms.py
+++ b/saleor/cart/forms.py
@@ -8,12 +8,11 @@ from django.utils.translation import pgettext, ugettext
from satchless.item import InsufficientStock
-class QuantityField(forms.DecimalField):
+class QuantityField(forms.IntegerField):
def __init__(self, *args, **kwargs):
super(QuantityField, self).__init__(
- *args, max_value=None, min_value=Decimal(0), max_digits=10,
- decimal_places=4, initial=Decimal(1), **kwargs)
+ *args, max_value=None, initial=1, **kwargs)
class AddToCartForm(forms.Form):
diff --git a/saleor/product/forms.py b/saleor/product/forms.py
index a8da3b13f4..db2baf4948 100644
--- a/saleor/product/forms.py
+++ b/saleor/product/forms.py
@@ -7,16 +7,15 @@ from .lookups import CollectionLookup
class BagForm(AddToCartForm):
- quantity = forms.IntegerField(initial=1)
def get_variant(self, clean_data):
return self.product.variants.get(product__color=self.product.color)
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)