diff options
author | 2020-11-08 19:05:06 +0200 | |
---|---|---|
committer | 2020-11-08 19:05:06 +0200 | |
commit | fcfcdd5463602eaedfe3ee13c45da248b1296923 (patch) | |
tree | f14f5779f1d04a8d2a9f4954941f22989e3959e1 /pydis_site/apps | |
parent | Fix missing URL tag in events index page (diff) |
Use path in variable instead getting it every time in kwargs
Diffstat (limited to 'pydis_site/apps')
-rw-r--r-- | pydis_site/apps/events/views/page.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pydis_site/apps/events/views/page.py b/pydis_site/apps/events/views/page.py index d3dcdf3f..89b03c1f 100644 --- a/pydis_site/apps/events/views/page.py +++ b/pydis_site/apps/events/views/page.py @@ -10,15 +10,16 @@ class PageView(TemplateView): def get_template_names(self) -> List[str]: """Get specific template names.""" - page_path = settings.PAGES_PATH / self.kwargs['path'] + path: str = self.kwargs['path'] + page_path = settings.PAGES_PATH / path if page_path.is_dir(): page_path = page_path / "_index.html" - self.kwargs['path'] = f"{self.kwargs['path']}/_index.html" + path = f"{path}/_index.html" else: - page_path = settings.PAGES_PATH / f"{self.kwargs['path']}.html" - self.kwargs['path'] = f"{self.kwargs['path']}.html" + page_path = settings.PAGES_PATH / f"{path}.html" + path = f"{path}.html" if not page_path.exists(): raise Http404 - return [f"events/{settings.PAGES_PATH.name}/{self.kwargs['path']}"] + return [f"events/{settings.PAGES_PATH.name}/path}"] |