Skip to content
Snippets Groups Projects

Add calendar page with link from calendar display

Merged jindra12 requested to merge features/add-calendar-page into test
4 files
+ 44
0
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 14
0
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"
Loading