Show terms and conditions link in the footer bottom

This commit is contained in:
PCoder 2024-07-19 13:38:15 +05:30
parent fc6f9e43a7
commit a68dcb7574

View file

@ -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'],
}