From 0d3380f215c51f0de74105b1e68588c5f42c1579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Tue, 18 May 2021 15:24:57 +0200 Subject: [PATCH] elections2021: Redirect on unknown plan or ministry --- elections2021/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elections2021/models.py b/elections2021/models.py index 5fe4a67a..84db38d2 100644 --- a/elections2021/models.py +++ b/elections2021/models.py @@ -1172,6 +1172,9 @@ class Elections2021ProgramPage( @route(r"^plan/([a-z-]+)/$") def plan_detail(self, request, param=None): plan = param if param in PLAN_OPTIONS else None + if not plan: + return HttpResponseRedirect(self.url) + title = None head_text = "" head_image = "" @@ -1219,6 +1222,9 @@ class Elections2021ProgramPage( @route(r"^resort/([a-z-]+)/$") def ministry_detail(self, request, param=None): ministry = param if param in MINISTRY_OPTIONS else None + if not ministry: + return HttpResponseRedirect(self.url) + title = None head_photo = None -- GitLab