Cleanup and use correct page for EN

This commit is contained in:
PCoder 2024-07-19 17:50:38 +05:30
parent a7abe02784
commit 9618ac0094

View file

@ -77,14 +77,12 @@ def menuitems_children(parent, context=None):
menuitems_children = parent.get_children().live().in_menu().specific()
items_to_remove = []
for menuitem in menuitems_children:
print('type => %s' % type(menuitem))
try:
if 'devenez' in menuitem.title.lower() and remove_devenez:
items_to_remove.append(menuitem)
elif 'mitglied werden' in menuitem.title.lower() and remove_mitglied:
items_to_remove.append(menuitem)
except AttributeError as ae:
print("Menuitem %s has an issue :: %s" % (menuitem.title, str(ae)))
pass
for item in items_to_remove:
menuitems_children = menuitems_children & Page.objects.not_page(item)
@ -94,6 +92,9 @@ def menuitems_children(parent, context=None):
if site.hostname 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)
if request.__dict__.get('LANGUAGE_CODE', 'de').lower() == 'en':
custom_page_id = 1020
else:
custom_page_id = 994
custom_page = Page.objects.get(id=custom_page_id)
menuitems_children = list(menuitems_children)