Cleanup
This commit is contained in:
parent
822fca63c3
commit
87332a9f05
1 changed files with 0 additions and 8 deletions
|
@ -91,7 +91,6 @@ def menuitems_children(parent, context=None):
|
|||
request = context['request']
|
||||
site = Site.find_for_request(request)
|
||||
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
|
||||
|
@ -99,11 +98,7 @@ def menuitems_children(parent, context=None):
|
|||
custom_page_id = 994
|
||||
custom_page = Page.objects.get(id=custom_page_id)
|
||||
menuitems_children = list(menuitems_children)
|
||||
if custom_page not in menuitems_children:
|
||||
#menuitems_children.append(custom_page)
|
||||
print("custom_page == ")
|
||||
page_ids = [page.id for page in menuitems_children]
|
||||
print("hostname is %s" % site.hostname)
|
||||
menuitems_children = Page.objects.filter(id__in=page_ids).specific()
|
||||
for menuitem in menuitems_children:
|
||||
try:
|
||||
|
@ -117,15 +112,12 @@ def menuitems_children(parent, context=None):
|
|||
def add_item_to_page_queryset(queryset, custom_page):
|
||||
# Convert queryset to a list
|
||||
pages_list = list(queryset)
|
||||
|
||||
# Add the custom page to the list
|
||||
pages_list.append(custom_page)
|
||||
|
||||
# Create a new ordered queryset based on the list order
|
||||
page_ids = [page.id for page in pages_list]
|
||||
preserved_order = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(page_ids)])
|
||||
new_queryset = Page.objects.filter(id__in=page_ids).order_by(preserved_order).specific()
|
||||
|
||||
return new_queryset
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue