From d199c3a681638cfc28d500986079153ea9f3e71c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 30 May 2024 13:47:13 +0100 Subject: [PATCH] Don't use page if there isn't one --- website/common/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/common/models.py b/website/common/models.py index 26e4489..f8cb088 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -298,7 +298,8 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage): page = self.get_listing_pages().order_by("?").first() if page is None: response = redirect(self.get_url(request=request), permanent=False) - response = redirect(page.get_url(request=request), permanent=False) + else: + response = redirect(page.get_url(request=request), permanent=False) response.headers["X-Robots-Tag"] = "noindex" return response