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

Add calendar pages

parent 04c6dafe
No related branches found
No related tags found
2 merge requests!804Release,!751Add calendar page with link from calendar display
import json
import logging
from datetime import date, timedelta
from pathlib import Path
import arrow
from django.core.serializers.json import DjangoJSONEncoder
......@@ -185,5 +186,18 @@ class CalendarPage(SubpageMixin, MetadataPageMixin, CalendarMixin, Page):
### 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:
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