From 9bc97f706d36d6ea3122f43120f4549699187739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Fri, 24 Jul 2020 13:57:15 +0200 Subject: [PATCH] majak: Improve comments in code --- districts/models.py | 8 ++++++++ home/models.py | 10 +++++++++ senat_campaign/models.py | 44 ++++++++++++++++++++++++++++++++++++++-- senate/models.py | 8 ++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/districts/models.py b/districts/models.py index 55697ff9..1be7afec 100644 --- a/districts/models.py +++ b/districts/models.py @@ -9,10 +9,14 @@ from tuning import help class DistrictsHomePage(MetadataPageMixin, Page): + ### FIELDS + matomo_id = models.IntegerField( "Matomo ID pro sledování návštěvnosti", blank=True, null=True ) + ### PANELS + promote_panels = [ MultiFieldPanel( [ @@ -29,7 +33,11 @@ class DistrictsHomePage(MetadataPageMixin, Page): FieldPanel("matomo_id"), ] + ### RELATIONS + subpage_types = [] + ### OTHERS + class Meta: verbose_name = "Krajský rozcestník" diff --git a/home/models.py b/home/models.py index 101171db..4a895a05 100644 --- a/home/models.py +++ b/home/models.py @@ -4,12 +4,22 @@ from wagtail.core.models import Page class HomeIndexPage(Page): + ### FIELDS + body = RichTextField("obsah") + ### PANELS + content_panels = Page.content_panels + [ FieldPanel("body"), ] + ### RELATIONS + + subpage_types = [] + + ### OTHERS + class Meta: verbose_name = "Maják homepage" diff --git a/senat_campaign/models.py b/senat_campaign/models.py index b3fb5250..91b986a9 100644 --- a/senat_campaign/models.py +++ b/senat_campaign/models.py @@ -54,6 +54,8 @@ class ContactBlock(blocks.StructBlock): class SenatCampaignHomePage(Page, MetadataPageMixin, CalendarMixin): + ### FIELDS + # top section headline = models.CharField("podtitulek pod jménem", max_length=250, blank=True) top_photo = models.ForeignKey( @@ -127,6 +129,8 @@ class SenatCampaignHomePage(Page, MetadataPageMixin, CalendarMixin): "Matomo ID pro sledování návštěvnosti", blank=True, null=True ) + ### PANELS + content_panels = Page.content_panels + [ MultiFieldPanel( [ @@ -185,12 +189,16 @@ class SenatCampaignHomePage(Page, MetadataPageMixin, CalendarMixin): StreamFieldPanel("contacts"), ] + ### RELATIONS + subpage_types = [ "senat_campaign.SenatCampaignNewsIndexPage", "senat_campaign.SenatCampaignProgramPage", "senat_campaign.SenatCampaignCookiesPage", ] + ### OTHERS + # flag for rendering anchor links in menu is_home = True @@ -276,8 +284,9 @@ class SenatCampaignHomePage(Page, MetadataPageMixin, CalendarMixin): class SenatCampaignNewsIndexPage(Page, SubpageMixin, MetadataPageMixin): - parent_page_types = ["senat_campaign.SenatCampaignHomePage"] - subpage_types = ["senat_campaign.SenatCampaignNewsPage"] + ### FIELDS + + ### PANELS promote_panels = [ MultiFieldPanel( @@ -294,6 +303,13 @@ class SenatCampaignNewsIndexPage(Page, SubpageMixin, MetadataPageMixin): settings_panels = [] + ### RELATIONS + + parent_page_types = ["senat_campaign.SenatCampaignHomePage"] + subpage_types = ["senat_campaign.SenatCampaignNewsPage"] + + ### OTHERS + # flag for rendering anchor links in menu is_home = False @@ -308,6 +324,8 @@ class SenatCampaignNewsIndexPage(Page, SubpageMixin, MetadataPageMixin): class SenatCampaignNewsPage(Page, SubpageMixin, MetadataPageMixin): + ### FIELDS + date = models.DateField("datum") perex = models.TextField("perex") body = RichTextField("článek", blank=True) @@ -321,6 +339,8 @@ class SenatCampaignNewsPage(Page, SubpageMixin, MetadataPageMixin): # we will use photo as search image search_image = None + ### PANELS + content_panels = Page.content_panels + [ FieldPanel("date"), FieldPanel("perex"), @@ -345,9 +365,13 @@ class SenatCampaignNewsPage(Page, SubpageMixin, MetadataPageMixin): ), ] + ### RELATIONS + parent_page_types = ["senat_campaign.SenatCampaignNewsIndexPage"] subpage_types = [] + ### OTHERS + # flag for rendering anchor links in menu is_home = False @@ -394,6 +418,8 @@ class ProgramBlock(blocks.StructBlock): class SenatCampaignProgramPage(Page, SubpageMixin, MetadataPageMixin): + ### FIELDS + committee_preference = StreamField( [("committee", blocks.CharBlock(label="výbor či komise"))], verbose_name="preferované výbory a komise", @@ -403,6 +429,8 @@ class SenatCampaignProgramPage(Page, SubpageMixin, MetadataPageMixin): [("item", ProgramBlock())], verbose_name="programové body", blank=True ) + ### PANELS + content_panels = Page.content_panels + [ StreamFieldPanel("committee_preference"), StreamFieldPanel("content"), @@ -423,9 +451,13 @@ class SenatCampaignProgramPage(Page, SubpageMixin, MetadataPageMixin): settings_panels = [] + ### RELATIONS + parent_page_types = ["senat_campaign.SenatCampaignHomePage"] subpage_types = [] + ### OTHERS + # flag for rendering anchor links in menu is_home = False @@ -434,8 +466,12 @@ class SenatCampaignProgramPage(Page, SubpageMixin, MetadataPageMixin): class SenatCampaignCookiesPage(Page, SubpageMixin, MetadataPageMixin): + ### FIELDS + body = RichTextField("obsah", blank=True) + ### PANELS + content_panels = Page.content_panels + [ FieldPanel("body", classname="full"), ] @@ -455,9 +491,13 @@ class SenatCampaignCookiesPage(Page, SubpageMixin, MetadataPageMixin): settings_panels = [] + ### RELATIONS + parent_page_types = ["senat_campaign.SenatCampaignHomePage"] subpage_types = [] + ### OTHERS + # flag for rendering anchor links in menu is_home = False diff --git a/senate/models.py b/senate/models.py index 517e251c..7e21a672 100644 --- a/senate/models.py +++ b/senate/models.py @@ -31,6 +31,8 @@ class PersonBlock(blocks.StructBlock): class SenateHomePage(MetadataPageMixin, Page): + ### FIELDS + senators = StreamField( [("item", PersonBlock())], verbose_name="naši senátoři", blank=True ) @@ -41,6 +43,8 @@ class SenateHomePage(MetadataPageMixin, Page): "Matomo ID pro sledování návštěvnosti", blank=True, null=True ) + ### PANELS + content_panels = Page.content_panels + [ StreamFieldPanel("senators"), StreamFieldPanel("candidates"), @@ -62,7 +66,11 @@ class SenateHomePage(MetadataPageMixin, Page): FieldPanel("matomo_id"), ] + ### RELATIONS + subpage_types = [] + ### OTHERS + class Meta: verbose_name = "Senátní rozcestník" -- GitLab