Skip to content
Snippets Groups Projects
Commit ba807611 authored by jindra12's avatar jindra12 Committed by jan.bednarik
Browse files

Rm calendar page mixin

parent 54406a49
No related branches found
No related tags found
2 merge requests!804Release,!751Add calendar page with link from calendar display
......@@ -88,10 +88,6 @@ class CalendarMixin(models.Model):
Calendar, null=True, blank=True, on_delete=models.PROTECT
)
@property
def first_calendar_page(self):
return self._first_subpage_of_type(CalendarPageMixin)
class Meta:
abstract = True
......@@ -149,26 +145,3 @@ class CalendarMixin(models.Model):
self.calendar = None
super().save(*args, **kwargs)
class CalendarPageMixin(CalendarMixin):
"""
Page mixin for displaying full calendar
"""
calendar_url = models.URLField(
"URL kalendáře ve formátu iCal", blank=False, null=True
)
### PANELS
content_panels = [
FieldPanel("calendar_url"),
]
### RELATIONS
subpage_types = []
class Meta:
abstract = True
# Generated by Django 4.1.8 on 2023-04-14 23:48
# Generated by Django 4.1.8 on 2023-04-27 18:52
import django.db.models.deletion
import wagtailmetadata.models
......@@ -9,9 +9,9 @@ import shared.models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("wagtailcore", "0083_workflowcontenttype"),
("calendar_utils", "0004_auto_20220505_1228"),
("wagtailcore", "0083_workflowcontenttype"),
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("district", "0108_alter_districtcenterpage_content_and_more"),
]
......@@ -33,7 +33,9 @@ class Migration(migrations.Migration):
(
"calendar_url",
models.URLField(
null=True, verbose_name="URL kalendáře ve formátu iCal"
blank=True,
null=True,
verbose_name="URL kalendáře ve formátu iCal",
),
),
(
......
......@@ -26,7 +26,7 @@ from wagtail.fields import RichTextField, StreamField
from wagtail.models import Orderable, Page
from wagtailmetadata.models import MetadataPageMixin
from calendar_utils.models import CalendarMixin, CalendarPageMixin
from calendar_utils.models import CalendarMixin
from maps_utils.blocks import MapPointBlock
from maps_utils.const import (
DEFAULT_MAP_STYLE,
......@@ -1695,14 +1695,14 @@ def make_feature_index_cache_key(feature: "DistrictGeoFeatureDetailPage"):
return f"DistrictGeoFeatureDetailPage::{feature.id}::index"
class DistrictCalendarPage(SubpageMixin, MetadataPageMixin, CalendarPageMixin, Page):
class DistrictCalendarPage(SubpageMixin, MetadataPageMixin, CalendarMixin, Page):
"""
Page for displaying full calendar
"""
### PANELS
content_panels = Page.content_panels + CalendarPageMixin.content_panels
content_panels = Page.content_panels + [FieldPanel("calendar_url")]
### RELATIONS
......
......@@ -5,8 +5,8 @@
<aside class="banner bg-orange-300 text-white h-full">
<i class="ico--calendar banner__icon"></i>
<div class="banner__body"><h1 class="head-alt-md banner__cta">Kalendář</h1>
{% if not fullscreen and page.root_page.first_calendar_page %}
<a href="{{ page.root_page.first_calendar_page.url }}">
{% if not fullscreen and page.calendar_page %}
<a href="{{ page.calendar_page.url }}">
<button class="btn btn--white btn--fullwidth sm:btn--autowidth mt-8">
<div class="btn__body">Zobrazit další</div>
</button>
......
# Generated by Django 4.1.8 on 2023-04-14 23:48
# Generated by Django 4.1.8 on 2023-04-27 18:52
import django.db.models.deletion
import wagtailmetadata.models
......@@ -9,9 +9,9 @@ import shared.models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("wagtailcore", "0083_workflowcontenttype"),
("calendar_utils", "0004_auto_20220505_1228"),
("wagtailcore", "0083_workflowcontenttype"),
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("uniweb", "0041_alter_uniwebflexiblepage_content_and_more"),
]
......@@ -33,7 +33,9 @@ class Migration(migrations.Migration):
(
"calendar_url",
models.URLField(
null=True, verbose_name="URL kalendáře ve formátu iCal"
blank=True,
null=True,
verbose_name="URL kalendáře ve formátu iCal",
),
),
(
......
......@@ -486,14 +486,14 @@ class UniwebFlexiblePage(
verbose_name = "Flexibilní stránka"
class UniwebCalendarPage(SubpageMixin, MetadataPageMixin, CalendarPageMixin, Page):
class UniwebCalendarPage(SubpageMixin, MetadataPageMixin, CalendarMixin, Page):
"""
Page for displaying full calendar
"""
### PANELS
content_panels = Page.content_panels + CalendarPageMixin.content_panels
content_panels = Page.content_panels + [FieldPanel("calendar_url")]
### RELATIONS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment