Compare commits

...

2 commits

Author SHA1 Message Date
PCoder
780a4ce2d7 Fix bug footer menu items not translated 2024-07-19 14:04:15 +05:30
PCoder
31a0a6b060 Search hostname instead of site object 2024-07-19 14:03:53 +05:30

View file

@ -78,22 +78,20 @@ def menuitems_children(parent, context=None):
items_to_remove = [] items_to_remove = []
for menuitem in menuitems_children: for menuitem in menuitems_children:
try: try:
if type(menuitem) == ContactForm:
menuitem.title = menuitem.title
else:
menuitem.title = menuitem.trans_title
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)
menuitem.title = menuitem.trans_title
except AttributeError: except AttributeError:
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)
if context: if context:
request = context['request'] request = context['request']
site = Site.find_for_request(request) site = Site.find_for_request(request)
if site 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 custom_page_id = 994