Don't use page if there isn't one
This commit is contained in:
parent
36211e88f2
commit
d199c3a681
1 changed files with 2 additions and 1 deletions
|
@ -298,6 +298,7 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
|
||||||
page = self.get_listing_pages().order_by("?").first()
|
page = self.get_listing_pages().order_by("?").first()
|
||||||
if page is None:
|
if page is None:
|
||||||
response = redirect(self.get_url(request=request), permanent=False)
|
response = redirect(self.get_url(request=request), permanent=False)
|
||||||
|
else:
|
||||||
response = redirect(page.get_url(request=request), permanent=False)
|
response = redirect(page.get_url(request=request), permanent=False)
|
||||||
response.headers["X-Robots-Tag"] = "noindex"
|
response.headers["X-Robots-Tag"] = "noindex"
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue