Skip to content

Commit

Permalink
bail out of search page if there is an error
Browse files Browse the repository at this point in the history
if there's an error don't try and process areas etc, just display the
form
  • Loading branch information
struan committed Apr 24, 2024
1 parent d231e75 commit a5b8a71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hub/views/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down

0 comments on commit a5b8a71

Please sign in to comment.