divio/django-shop — Issue #112: Bug in template samples
Author: jrief
Created: 2011-11-01 10:00:21+00:00
State: open

The current templates do not reflect the ManyToMany model between categories and products.
Is there an other way to submit patches, rather than Email?

diff --git a/shop/templates/shop/product_detail.html b/shop/templates/shop/product_detail.html
index 70d4ade..323b061 100644
--- a/shop/templates/shop/product_detail.html
+++ b/shop/templates/shop/product_detail.html
@@ -10,8 +10,8 @@

{{object.unit_price}}

-{% if object.category %}
-{{object.category.name}}
+{% if object.categories %}
+{% for cat in object.categories.all %} {{ cat.name }} {% endfor %}
{% else %}
(Product is at root category)
{% endif %}
diff --git a/shop/templates/shop/product_list.html b/shop/templates/shop/product_list.html
index c7314c0..6439c39 100644
--- a/shop/templates/shop/product_list.html
+++ b/shop/templates/shop/product_list.html
@@ -13,8 +13,8 @@

{{object.unit_price}}

-{% if object.category %}
-{{object.category.name}}

+{% if object.categories %}
+{% for cat in object.categories.all %} {{ cat.name }}
{% endfor %}
{% else %}
(Product is at root category)

{% endif %}