From a68dcb7574624569d36b0316426ef6cd590c9bad Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 19 Jul 2024 13:38:15 +0530 Subject: [PATCH] Show terms and conditions link in the footer bottom --- publichealth/home/templatetags/navigation.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py index 9d984e9..f9e9896 100644 --- a/publichealth/home/templatetags/navigation.py +++ b/publichealth/home/templatetags/navigation.py @@ -67,7 +67,7 @@ def top_menu(context, parent, calling_page=None): 'request': context['request'], } -def menuitems_children(parent): +def menuitems_children(parent, context=None): remove_mitglied = False remove_devenez = False if 'Qui sommes-nous' in parent.title: @@ -90,6 +90,18 @@ def menuitems_children(parent): pass for item in items_to_remove: menuitems_children = menuitems_children & Page.objects.not_page(item) + if context: + request = context['request'] + site = Site.find_for_request(request) + if site in ['sphc.ch', 'public-health.ch']: + print("site is %s, add terms and conditions to footer" % site.hostname) + # custom page here is the terms and conditions page for public-health.ch and sphc.ch (common) + custom_page_id = 994 + custom_page = Page.objects.get(id=custom_page_id) + menuitems_children = list(menuitems_children) + menuitems_children.append(custom_page) + page_ids = [page.id for page in menuitems_children] + menuitems_children = Page.objects.filter(id__in=page_ids).specific() return menuitems_children # Retrieves the children of the top menu items for the drop downs @@ -106,6 +118,6 @@ def top_menu_children(context, parent): def footer_menu(context, parent, calling_page=None): return { 'calling_page': calling_page, - 'menuitems': menuitems_children(parent), + 'menuitems': menuitems_children(parent, context), 'request': context['request'], }