from django import forms
from django.utils.translation import gettext_lazy as _
from product.models import Product
from parler.forms import TranslatableModelForm


class ProductDetailForm(TranslatableModelForm):

    class Meta:
        model = Product
        fields = ('name', 'description', 'price', 'salesamount')


PRODUCT_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 21)]


class CartAddProductForm(forms.Form):
    quantity = forms.TypedChoiceField(choices=PRODUCT_QUANTITY_CHOICES,
                                      coerce=int, label=_('Quantity'))
    update = forms.BooleanField(required=False, initial=False, label=_('Update'),
                                widget=forms.HiddenInput)
