diff --git a/django/didgeridoo/webshop/forms.py b/django/didgeridoo/webshop/forms.py index 0139e27..925929a 100644 --- a/django/didgeridoo/webshop/forms.py +++ b/django/didgeridoo/webshop/forms.py @@ -68,10 +68,19 @@ class AddToCartForm(forms.Form): class CartForm(forms.Form): - amount_field = forms.FloatField( - label='pce', - help_text='Enter a Value between 1 and 99.') - print('cartform', amount_field) + amount_field = forms.IntegerField( + label='pce', + help_text='Enter a Value between 1 and 99.') + + def change_amount(self, article): + print('CartForm.ChangeAmount') + position = CartPosition.objects.get(article=article) + self.amount_field = forms.IntegerField( + label='pce', + help_text='Enter a Value between 1 and 99.', + initial=position.amount + ) + return self.amount_field class CheckoutForm(forms.Form): diff --git a/django/didgeridoo/webshop/views.py b/django/didgeridoo/webshop/views.py index bb721c1..498ed57 100644 --- a/django/didgeridoo/webshop/views.py +++ b/django/didgeridoo/webshop/views.py @@ -193,6 +193,7 @@ def registration(request): def cart(request): category_list = get_categories() currencies_form = CurrenciesForm + cart_form = CartForm rate = ExchangeRate article_view = True currency_name = "CHF" @@ -301,6 +302,7 @@ def cart(request): {'cart_position_list': cart_position_list, 'totalprice_list': totalprice_list, 'total': total, + 'cart_form': cart_form, 'currencies_form': currencies_form, 'amount_form': amount_form, 'article_view': article_view,