From 1a0555e081d814732cbef64318a94d650007456b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <tomas@imaniti.org>
Date: Tue, 11 Jun 2024 23:06:09 +0200
Subject: [PATCH] fix menu iterator

---
 elections/templates/elections/elections_contact_page.html | 2 +-
 main/templates/main/main_contact_page.html                | 2 +-
 shared/models/main.py                                     | 8 +++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/elections/templates/elections/elections_contact_page.html b/elections/templates/elections/elections_contact_page.html
index 00b3d628..263a5e5c 100644
--- a/elections/templates/elections/elections_contact_page.html
+++ b/elections/templates/elections/elections_contact_page.html
@@ -1 +1 @@
-{% extends "styleguide2/contact_page.html" with show_regional_contacts=True %}
+{% include "styleguide2/contact_page.html" with show_regional_contacts=True %}
diff --git a/main/templates/main/main_contact_page.html b/main/templates/main/main_contact_page.html
index 00b3d628..263a5e5c 100644
--- a/main/templates/main/main_contact_page.html
+++ b/main/templates/main/main_contact_page.html
@@ -1 +1 @@
-{% extends "styleguide2/contact_page.html" with show_regional_contacts=True %}
+{% include "styleguide2/contact_page.html" with show_regional_contacts=True %}
diff --git a/shared/models/main.py b/shared/models/main.py
index d27601a1..c708723b 100644
--- a/shared/models/main.py
+++ b/shared/models/main.py
@@ -247,7 +247,13 @@ class PageInMenuMixin(Page):
             else parent_instance
         )
 
-        for menu in instance.root_page.menu:
+        menu_iterator = (
+            instance.root_page.menu
+            if hasattr(instance, "root_page")
+            else instance.menu
+        )
+
+        for menu in menu_iterator:
             if menu.block_type == "menu_item":
                 if menu.value["page"] is None:
                     continue
-- 
GitLab