]> git.parisson.com Git - mezzo.git/commitdiff
Task #311 #257 : add product list into Team and Department page
authorEmilie <zawadzki@ircam.fr>
Wed, 26 Oct 2016 13:22:03 +0000 (15:22 +0200)
committerEmilie <zawadzki@ircam.fr>
Wed, 26 Oct 2016 13:22:03 +0000 (15:22 +0200)
app/organization/network/admin.py
app/templates/pages/departmentpage.html
app/templates/pages/teampage.html

index d2ce9d4e10dc094b9b7b005e75940cadd18c93c4..7e29ea4c72e8493198e5acf5697baa8dae2f1dee 100644 (file)
@@ -10,6 +10,7 @@ from organization.network.forms import *
 from organization.pages.models import *
 from organization.core.admin import *
 from organization.pages.admin import PageImageInline, PageBlockInline, PagePlaylistInline
+from organization.shop.models import PageProductList
 
 
 class OrganizationPlaylistInline(TabularDynamicInlineAdmin):
@@ -42,9 +43,14 @@ class OrganizationAdmin(BaseTranslationModelAdmin):
     list_display = ['name', 'admin_thumb']
 
 
+class PageProductListInline(TabularDynamicInlineAdmin):
+
+    model = PageProductList
+
+
 class DepartmentPageAdmin(PageAdmin):
 
-    inlines = [PageImageInline, PageBlockInline, PagePlaylistInline, ]
+    inlines = [PageImageInline, PageBlockInline, PagePlaylistInline, PageProductListInline, ]
 
 
 class DepartmentAdmin(BaseTranslationModelAdmin):
@@ -60,7 +66,7 @@ class TeamAdmin(BaseTranslationModelAdmin):
 
 class TeamPageAdmin(PageAdmin):
 
-    inlines = [PageImageInline, PageBlockInline, PagePlaylistInline, ]
+    inlines = [PageImageInline, PageBlockInline, PagePlaylistInline, PageProductListInline, ]
 
 
 class PersonAdminBase(BaseTranslationModelAdmin):
index 288528b43e707e2531333d192b257924d762a21e..a47829e8c0e9f52820f6c88c241576eceff78d41 100644 (file)
             </div>
         </div>
     {% endif %}
+{% endblock %}
 
+{% block products %}
+    {% if page.departmentpage.product_lists.all|length > 0 %}
+        {% for page_product_list in page.departmentpage.product_lists.all %}
+          {% with page_product_list.list as list %}
+            {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
+              {% include template %}
+            {% endwith %}
+          {% endwith %}
+        {% endfor %}
+    {% endif %}
 {% endblock %}
 
 {% block logo %}
index de3ea921a908793566461204e48d9b5086673674..1126e7460cdeb2b536a679f894421c43e237b9a8 100644 (file)
 {% endblock %}
 
 {% block products %}
-{% if page.teampage.product_lists.all %}
-    <h4>{% trans "Products" %}</h4>
-    {% for page_product_list in page.teampage.product_lists.all %}
-      {% with page_product_list.list as list %}
-        {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
-          {% include template %}
-        {% endwith %}
-      {% endwith %}
-    {% endfor %}
-{% endif %}
+    {% if page.teampage.product_lists.all|length > 0 %}
+        {% for page_product_list in page.teampage.product_lists.all %}
+          {% with page_product_list.list as list %}
+            {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
+              {% include template %}
+            {% endwith %}
+          {% endwith %}
+        {% endfor %}
+    {% endif %}
 {% endblock %}
 
+
 {% block logo %}
     {% with page.teampage.images.all|get_type:'logo' as images %}
         {% if images %}