From 5b28f2e34db07d6807a4c11e5364e3fed51a7b82 Mon Sep 17 00:00:00 2001 From: Emilie Date: Wed, 26 Oct 2016 15:22:03 +0200 Subject: [PATCH] Task #311 #257 : add product list into Team and Department page --- app/organization/network/admin.py | 10 ++++++++-- app/templates/pages/departmentpage.html | 11 +++++++++++ app/templates/pages/teampage.html | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/app/organization/network/admin.py b/app/organization/network/admin.py index d2ce9d4e..7e29ea4c 100644 --- a/app/organization/network/admin.py +++ b/app/organization/network/admin.py @@ -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): diff --git a/app/templates/pages/departmentpage.html b/app/templates/pages/departmentpage.html index 288528b4..a47829e8 100644 --- a/app/templates/pages/departmentpage.html +++ b/app/templates/pages/departmentpage.html @@ -88,7 +88,18 @@ {% 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 %} diff --git a/app/templates/pages/teampage.html b/app/templates/pages/teampage.html index de3ea921..1126e746 100644 --- a/app/templates/pages/teampage.html +++ b/app/templates/pages/teampage.html @@ -126,18 +126,18 @@ {% endblock %} {% block products %} -{% if page.teampage.product_lists.all %} -

{% trans "Products" %}

- {% 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 %} -- 2.39.5