From a5b8a71d384e77624e359cff6c194654a26d8781 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 24 Apr 2024 17:23:32 +0100 Subject: [PATCH] bail out of search page if there is an error if there's an error don't try and process areas etc, just display the form --- hub/views/area.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hub/views/area.py b/hub/views/area.py index e89a8979a..5e862bb33 100644 --- a/hub/views/area.py +++ b/hub/views/area.py @@ -462,6 +462,9 @@ def get_context_data(self, **kwargs): "error" ] = f"Sorry, we can’t find any matches for “{search}”. Try a nearby town or city?" + if context.get("error") is not None: + return context + if context["areas"] is not None and len(context["areas"]): # Add MPs and PPCs to areas for area in context["areas"]: