Products should be viewable when not logged in.
This commit is contained in:
parent
c214036c51
commit
475f996a02
|
@ -5,9 +5,21 @@
|
||||||
|
|
||||||
<h2>{{ product.name }}</h2>
|
<h2>{{ product.name }}</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ product.description }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if user.is_authenticated %}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form form %}
|
{% bootstrap_form form %}
|
||||||
{% bootstrap_button "Add to order" button_type="submit" button_class="btn-primary" %}
|
{% bootstrap_button "Add to order" button_type="submit" button_class="btn-primary" %}
|
||||||
</form>
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url 'account_signup' %}?next={% url 'shop:product_detail' slug=product.slug %}">
|
||||||
|
Signup</a> or
|
||||||
|
<a href="{% url 'account_login' %}?next={% url 'shop:product_detail' slug=product.slug %}">
|
||||||
|
login</a>
|
||||||
|
to order this product
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class ShopIndexView(ListView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class ProductDetailView(LoginRequiredMixin, FormView, DetailView):
|
class ProductDetailView(FormView, DetailView):
|
||||||
model = Product
|
model = Product
|
||||||
template_name = 'product_detail.html'
|
template_name = 'product_detail.html'
|
||||||
form_class = AddToOrderForm
|
form_class = AddToOrderForm
|
||||||
|
|
Loading…
Reference in a new issue