From eb776359205bf8fb261579c930ebe4ded52858cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Thu, 1 Feb 2018 17:02:08 +0100 Subject: [PATCH] first hit to addtocartform --- django/didgeridoo/webshop/forms.py | 8 ++ .../templates/webshop/article_details.html | 5 ++ .../webshop/templates/webshop/nav.html | 4 +- django/didgeridoo/webshop/views.py | 78 ++++++++++++------- 4 files changed, 66 insertions(+), 29 deletions(-) diff --git a/django/didgeridoo/webshop/forms.py b/django/didgeridoo/webshop/forms.py index 5e431a9..4e8080e 100644 --- a/django/didgeridoo/webshop/forms.py +++ b/django/didgeridoo/webshop/forms.py @@ -51,3 +51,11 @@ class PictureForm(forms.ModelForm): class Meta: model = Picture fields = ['name', 'article', 'image'] + + +class AddToCartForm(forms.Form): + amount = forms.IntegerField( + label='Amount in piece.', + help_text="Enter a Value between 1 and 99.", + initial=1) + print("in AddToCartForm() printing") diff --git a/django/didgeridoo/webshop/templates/webshop/article_details.html b/django/didgeridoo/webshop/templates/webshop/article_details.html index 8703063..eda8ff6 100644 --- a/django/didgeridoo/webshop/templates/webshop/article_details.html +++ b/django/didgeridoo/webshop/templates/webshop/article_details.html @@ -6,6 +6,11 @@

Stock: {{ article.stock }}

Status: {{ article.status }}

Price: {{ article.price_in_chf }} {{ currency_name }}

+
+ {{ amount.as_p }} + + {% csrf_token %} +
{% for picture in picture_list %}

{% endfor %} diff --git a/django/didgeridoo/webshop/templates/webshop/nav.html b/django/didgeridoo/webshop/templates/webshop/nav.html index 9b01f06..d5c22c9 100644 --- a/django/didgeridoo/webshop/templates/webshop/nav.html +++ b/django/didgeridoo/webshop/templates/webshop/nav.html @@ -19,9 +19,9 @@ LOGIN {% endif %} -
  • +