fixed: load all toplevel pages from the db, but only show active pages in the top menu.
This commit is contained in:
@@ -25,9 +25,7 @@ def content_menus(request):
|
|||||||
# erzeuge das Top-Level Menü
|
# erzeuge das Top-Level Menü
|
||||||
top_level_pages = cache.get('top_level_pages')
|
top_level_pages = cache.get('top_level_pages')
|
||||||
if top_level_pages is None:
|
if top_level_pages is None:
|
||||||
top_level_pages = models.Page.objects.filter(
|
top_level_pages = models.Page.objects.filter(parent=None)
|
||||||
parent=None, status=STATUS_PUBLISHED
|
|
||||||
)
|
|
||||||
top_level_pages = top_level_pages.exclude(slug='index')
|
top_level_pages = top_level_pages.exclude(slug='index')
|
||||||
top_level_pages = top_level_pages.order_by('position')
|
top_level_pages = top_level_pages.order_by('position')
|
||||||
top_level_pages = top_level_pages.prefetch_related('subpages')
|
top_level_pages = top_level_pages.prefetch_related('subpages')
|
||||||
@@ -52,7 +50,7 @@ def content_menus(request):
|
|||||||
break
|
break
|
||||||
current_path = current_path[0:current_path.rfind('.')]
|
current_path = current_path[0:current_path.rfind('.')]
|
||||||
|
|
||||||
return {'top_menu_items': top_level_pages,
|
return {'top_menu_items': top_level_pages.filter(status=STATUS_PUBLISHED),
|
||||||
'current_top_page': current_top_page,
|
'current_top_page': current_top_page,
|
||||||
'current_path': current_path,
|
'current_path': current_path,
|
||||||
'current_page': current_page}
|
'current_page': current_page}
|
||||||
|
|||||||
Reference in New Issue
Block a user