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() menuitems_children = parent.get_children().live().in_menu().specific()
items_to_remove = [] items_to_remove = []
for menuitem in menuitems_children: for menuitem in menuitems_children:
print('type => %s' % type(menuitem))
try: try:
if 'devenez' in menuitem.title.lower() and remove_devenez: if 'devenez' in menuitem.title.lower() and remove_devenez:
items_to_remove.append(menuitem) items_to_remove.append(menuitem)
elif 'mitglied werden' in menuitem.title.lower() and remove_mitglied: elif 'mitglied werden' in menuitem.title.lower() and remove_mitglied:
items_to_remove.append(menuitem) items_to_remove.append(menuitem)
except AttributeError as ae: except AttributeError as ae:
print("Menuitem %s has an issue :: %s" % (menuitem.title, str(ae)))
pass pass
for item in items_to_remove: for item in items_to_remove:
menuitems_children = menuitems_children & Page.objects.not_page(item) menuitems_children = menuitems_children & Page.objects.not_page(item)
@ -94,7 +92,10 @@ def menuitems_children(parent, context=None):
if site.hostname in ['sphc.ch', 'public-health.ch']: if site.hostname in ['sphc.ch', 'public-health.ch']:
print("site is %s, add terms and conditions to footer" % site.hostname) 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 here is the terms and conditions page for public-health.ch and sphc.ch (common)
custom_page_id = 994 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) custom_page = Page.objects.get(id=custom_page_id)
menuitems_children = list(menuitems_children) menuitems_children = list(menuitems_children)
menuitems_children.append(custom_page) menuitems_children.append(custom_page)