{% extends 'main.html' %}

{% block content %}

{% load staticfiles %}
    <hr>
    <h3>Product Detail</h3>

    <ul>

      <li>Title: {{ product.title }}</li>
      <li>Description: {{ product.description }}</li>
      {% if product.quantity > 0 %}
        <li>Quantity Available: {{ product.quantity }}</li>
      {% else %}
        <li>Quantity Available: Out of Stock</li>
      {% endif %}
      <li>Quantity Sold: {{ product.quantity_sold }}</li>
      <li>Price/Unit: {{ product.price }}</li>      
    </ul>
    
  {% if user.is_authenticated %}
      {% if product.quantity > 0 %}
        <form action="/add_to_cart/{{product.id}}/" method="POST">
          {% csrf_token %}
            <button>Add to Cart</button>
        </form>
      {% endif %}


    {% if user.is_authenticated %}
    <form action="/add_to_cart/{{ product.id }}/" method="POST">
    <hr>
    {% csrf_token %}
        <button class="btn btn-success btn-lg">Add to Cart</button>
    </form>
    {% endif %}


{% endblock %}
{% extends 'main.html' %}

{% block content %}

{% load staticfiles %}
    <hr>
    <h3>Product Detail</h3>

    <ul>

      <li>Title: {{ product.title }}</li>
      <li>Description: {{ product.description }}</li>
      {% if product.quantity > 0 %}
        <li>Quantity Available: {{ product.quantity }}</li>
      {% else %}
        <li>Quantity Available: Out of Stock</li>
      {% endif %}
      <li>Quantity Sold: {{ product.quantity_sold }}</li>
      <li>Price/Unit: {{ product.price }}</li>      
    </ul>
    
  {% if user.is_authenticated %}
      {% if product.quantity > 0 %}
      <form action="/add_to_cart/{{ product.id }}/" method="POST">
      <hr>
      {% csrf_token %}
          <button class="btn btn-success btn-lg">Add to Cart</button>
      </form>
      {% endif %}
  {% endif %}


{% endblock %}
Fix for duplicate template code
Fix for duplicate template code
