From 475f996a0211669acbe4a6d0462686e21a873a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 30 May 2016 19:25:34 +0200 Subject: [PATCH] Products should be viewable when not logged in. --- shop/templates/product_detail.html | 12 ++++++++++++ shop/views.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/shop/templates/product_detail.html b/shop/templates/product_detail.html index 07ad2cc8..0d47aa14 100644 --- a/shop/templates/product_detail.html +++ b/shop/templates/product_detail.html @@ -5,9 +5,21 @@

{{ product.name }}

+

+ {{ product.description }} +

+ +{% if user.is_authenticated %}
{% csrf_token %} {% bootstrap_form form %} {% bootstrap_button "Add to order" button_type="submit" button_class="btn-primary" %}
+{% else %} + + Signup or + + login +to order this product +{% endif %} {% endblock %} diff --git a/shop/views.py b/shop/views.py index 394289f6..e7c85b33 100644 --- a/shop/views.py +++ b/shop/views.py @@ -120,7 +120,7 @@ class ShopIndexView(ListView): return context -class ProductDetailView(LoginRequiredMixin, FormView, DetailView): +class ProductDetailView(FormView, DetailView): model = Product template_name = 'product_detail.html' form_class = AddToOrderForm