diff options
author | 2020-10-29 20:07:56 +0200 | |
---|---|---|
committer | 2020-10-29 20:07:56 +0200 | |
commit | e588e7476671475583dbc00cd1db81c9d73415f2 (patch) | |
tree | 0c1a263655341777a90f9628091a241864ff5812 /pydis_site/apps/events/views | |
parent | Fix resources pre-commit (diff) |
Apply changes of pages location to views and settings
Diffstat (limited to 'pydis_site/apps/events/views')
-rw-r--r-- | pydis_site/apps/events/views/page.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/pydis_site/apps/events/views/page.py b/pydis_site/apps/events/views/page.py index 1e3532f9..d3dcdf3f 100644 --- a/pydis_site/apps/events/views/page.py +++ b/pydis_site/apps/events/views/page.py @@ -1,27 +1,24 @@ -from pathlib import Path from typing import List from django.conf import settings from django.http import Http404 from django.views.generic import TemplateView -PAGES_PATH = Path(settings.BASE_DIR, "pydis_site", "apps", "events", "pages") - class PageView(TemplateView): """Handles event pages showing.""" def get_template_names(self) -> List[str]: - """Get specific template names""" - page_path = PAGES_PATH / self.kwargs['path'] - if page_path.exists() and page_path.is_dir(): - page_path = page_path.joinpath("_index.html") + """Get specific template names.""" + page_path = settings.PAGES_PATH / self.kwargs['path'] + if page_path.is_dir(): + page_path = page_path / "_index.html" self.kwargs['path'] = f"{self.kwargs['path']}/_index.html" else: - page_path = PAGES_PATH.joinpath(f"{self.kwargs['path']}.html") + page_path = settings.PAGES_PATH / f"{self.kwargs['path']}.html" self.kwargs['path'] = f"{self.kwargs['path']}.html" if not page_path.exists(): raise Http404 - return [self.kwargs['path']] + return [f"events/{settings.PAGES_PATH.name}/{self.kwargs['path']}"] |