Skip to content
Snippets Groups Projects
Verified Commit 1c2ae128 authored by jindra12's avatar jindra12
Browse files

Add calendar pages

parent a4aa4cce
No related branches found
No related tags found
No related merge requests found
import logging import logging
from datetime import date, timedelta from datetime import date, timedelta
from pathlib import Path
import arrow import arrow
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
...@@ -144,5 +145,18 @@ class CalendarPage(SubpageMixin, MetadataPageMixin, CalendarMixin, Page): ...@@ -144,5 +145,18 @@ class CalendarPage(SubpageMixin, MetadataPageMixin, CalendarMixin, Page):
### OTHERS ### OTHERS
def get_template(self, request):
"""
Allows this template to dynamically load correct calendar_page, based on root page which helps it determine from
which project the page should be loaded
"""
module = self.root_page.__class__.__module__ # Example: "district.module"
pathname = module.split(".")[0] # Gets "district" from "district.module"
root = str(Path(__file__).parents[2])
project = root + "/majak"
return (
project + "/" + pathname + "/templates/" + pathname + "_calendar_page.html"
)
class Meta: class Meta:
verbose_name = "Stránka s kalendářem" verbose_name = "Stránka s kalendářem"
{% extends "district/base.html" %}
{% load wagtailcore_tags %}
{% block content %}
<main>
<section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
{% include "shared/calendar_current_events_snippet.html" with fullscreen=True %}
</section>
</main>
{% endblock %}
{% extends "senat_campaign/base.html" %}
{% load wagtailcore_tags %}
{% block content %}
<main>
<section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
{% include "shared/calendar_current_events_snippet.html" with fullscreen=True %}
</section>
</main>
{% endblock %}
{% extends "uniweb/base.html" %}
{% load wagtailcore_tags %}
{% block content %}
<main>
<section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
{% include "shared/calendar_current_events_snippet.html" with fullscreen=True %}
</section>
</main>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment