blob: adf9e952c4191f8f87574ec877d7834ff8e059a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
from django.conf import settings
from django.http import Http404
from django.views.generic import TemplateView
class PageView(TemplateView):
"""Handles event pages showing."""
def get_template_names(self) -> list[str]:
"""Get specific template names."""
path: str = self.kwargs['path']
page_path = settings.EVENTS_PAGES_PATH / path
if page_path.is_dir():
page_path = page_path / "_index.html"
path = f"{path}/_index.html"
else:
page_path = settings.EVENTS_PAGES_PATH / f"{path}.html"
path = f"{path}.html"
if not page_path.exists():
raise Http404
return [f"events/{settings.EVENTS_PAGES_PATH.name}/{path}"]
|