From 015cd41c0020e324bd11e91d55c3806aaa9fb8a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <tomas@imaniti.org>
Date: Fri, 21 Jun 2024 18:36:55 +0200
Subject: [PATCH] fix root_page getting

---
 shared/models/main.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shared/models/main.py b/shared/models/main.py
index 7e663a03..e130483c 100644
--- a/shared/models/main.py
+++ b/shared/models/main.py
@@ -92,7 +92,7 @@ class ExtendedMetadataHomePageMixin(models.Model):
         title = super().get_meta_title()
         suffix = self.get_meta_title_suffix()
 
-        if title == self.root_page.title:
+        if hasattr(self, "root_page") and title == self.root_page.title:
             return f"Domů | Piráti {suffix}"
 
         # Covers scenario when title_suffix is not set and evaluates to super().get_meta_title() value.
@@ -137,7 +137,7 @@ class ExtendedMetadataPageMixin(models.Model):
         title = super().get_meta_title()
         suffix = self.get_meta_title_suffix()
 
-        if title == self.root_page.title:
+        if hasattr(self, "root_page") and title == self.root_page.title:
             return f"Domů | Piráti {suffix}"
 
         # Covers scenario when title_suffix is not set and evaluates to super().get_meta_title() value.
-- 
GitLab