From ba2db26a7ebf31d9008e99f7c8ea7f73c237bdb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <tomas@imaniti.org>
Date: Wed, 12 Jun 2024 16:36:24 +0200
Subject: [PATCH] hide other party when there is no party defined, minor fixes

---
 district/models.py    | 19 ++++++++++---------
 shared/models/main.py |  2 +-
 uniweb/blocks.py      |  5 ++++-
 uniweb/models.py      |  1 +
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/district/models.py b/district/models.py
index 68ffebb2..ba654fa5 100644
--- a/district/models.py
+++ b/district/models.py
@@ -125,15 +125,6 @@ class DistrictHomePage(CalendarMixin, MainHomePageMixin):
         "Text tlačítka kalendáře", max_length=256, default="Kalendář"
     )
 
-    gdpr_and_cookies_page = models.ForeignKey(
-        # Keep this a reference to the main website's GDPR page. Not ideal, but works (for now).
-        "main.MainSimplePage",
-        verbose_name="Stránka pro GDPR",
-        on_delete=models.PROTECT,
-        blank=True,
-        null=True,
-    )
-
     # --- END New fields ---
 
     # Extra komentar v paticce
@@ -170,6 +161,10 @@ class DistrictHomePage(CalendarMixin, MainHomePageMixin):
 
     ### EDIT HANDLERS
 
+    settings_panels = [
+        FieldPanel("matomo_id"),
+    ]
+
     edit_handler = TabbedInterface(
         [
             ObjectList(MainHomePageMixin.content_panels, heading="Obsah"),
@@ -201,6 +196,12 @@ class DistrictHomePage(CalendarMixin, MainHomePageMixin):
     class Meta:
         verbose_name = "Oblastní sdružení"
 
+    @property
+    def gdpr_and_cookies_page(self):
+        from main.models import MainHomePage
+
+        return MainHomePage.objects.first().gdpr_and_cookies_page
+
     @property
     def articles_page_model(self):
         return DistrictArticlesPage
diff --git a/shared/models/main.py b/shared/models/main.py
index 472c8751..e74103ef 100644
--- a/shared/models/main.py
+++ b/shared/models/main.py
@@ -1492,7 +1492,7 @@ class MainArticlePageMixin(
 
     ### BEGIN Panels
 
-    content_panels = [
+    content_panels = Page.content_panels + [
         FieldPanel("timestamp"),
         FieldPanel("perex"),
         FieldPanel("content"),
diff --git a/uniweb/blocks.py b/uniweb/blocks.py
index c93513ee..b69c71ae 100644
--- a/uniweb/blocks.py
+++ b/uniweb/blocks.py
@@ -74,7 +74,10 @@ class PersonContactBlock(StructBlock):
     position = CharBlock(label="Název pozice", required=False)
     person = PageChooserBlock(
         label="Osoba",
-        page_type=["uniweb.UniwebPersonPage"],
+        page_type=[
+            "uniweb.UniwebPersonPage",
+            "district.DistrictPersonPage",
+        ],
     )
 
     class Meta:
diff --git a/uniweb/models.py b/uniweb/models.py
index 76c68425..39383094 100644
--- a/uniweb/models.py
+++ b/uniweb/models.py
@@ -205,6 +205,7 @@ class MenuItemBlock(blocks.StructBlock):
             "uniweb.UniwebPeoplePage",
             "uniweb.UniwebPersonPage",
             "uniweb.UniwebPdfPage",
+            "district.DistrictPersonPage",
         ],
     )
 
-- 
GitLab