@@ -157,7 +157,7 @@ def get_menu_node_for_page(renderer, page, language, fallbacks=None, endpoint=Fa
157
157
url = url ,
158
158
id = page .pk ,
159
159
attr = attr ,
160
- visible = page . get_in_navigation ( page_content .language ) ,
160
+ visible = page_content .in_navigation ,
161
161
path = page_url .path or page_url .slug ,
162
162
language = (page_content .language if page_content .language != language else None ),
163
163
)
@@ -260,13 +260,11 @@ def get_nodes(self, request):
260
260
queryset = translations_qs ,
261
261
)
262
262
prefetch_related_objects (pages , urls_lookup , translations_lookup )
263
- # Build the blank title instances only once
264
- blank_page_content_cache = {language : EmptyPageContent (language = language ) for language in languages }
265
-
263
+
266
264
def _page_to_node (page ):
267
- # EmptyPageContent is used to prevent the cms from trying
268
- # to find a translation in the database
269
- page . page_content_cache = blank_page_content_cache . copy ()
265
+ # We're only filling the existing urls and page contents into the cache
266
+ # Access the cache directly to not lead to a db hit when accessing
267
+ # non-existing languages
270
268
271
269
for page_url in page .filtered_urls :
272
270
page .urls_cache [page_url .language ] = page_url
@@ -285,11 +283,9 @@ def _page_to_node(page):
285
283
286
284
menu_nodes = []
287
285
286
+ cut_homepage = homepage and not homepage .get_in_navigation (lang )
288
287
for page in pages :
289
288
if menu_node := _page_to_node (page ):
290
- # Only add pages with at least one page content
291
- cut_homepage = homepage and not homepage .get_in_navigation (lang )
292
-
293
289
if cut_homepage and page .parent_id == homepage .pk :
294
290
# When the homepage is hidden from navigation,
295
291
# we need to cut all its direct children from it.
0 commit comments