Merge branch 'cart' of git.2li.ch:ibz/web_AI-5 into cart

* 'cart' of git.2li.ch:ibz/web_AI-5:
  push form hack

# Conflicts:
#	django/didgeridoo/webshop/forms.py
#	django/didgeridoo/webshop/templates/webshop/cart.html
#	django/didgeridoo/webshop/views.py
This commit is contained in:
Ivan Hörler 2018-02-19 20:05:04 +01:00
commit c5419bfc60
2 changed files with 15 additions and 4 deletions

View File

@ -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):

View File

@ -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,