diff --git a/request_a_govuk_domain/request/middleware.py b/request_a_govuk_domain/request/middleware.py index 80184b29..ab4770f0 100644 --- a/request_a_govuk_domain/request/middleware.py +++ b/request_a_govuk_domain/request/middleware.py @@ -8,9 +8,18 @@ def __init__(self, get_response): def __call__(self, request): response = self.get_response(request) - if request.path != reverse("start") and not self.is_valid_progress(request): - return redirect("start") # Redirect to start page if progress is invalid - return response + if self.is_valid_start_path(request.path): + return response + if self.is_valid_progress(request): + return response + return redirect("start") # Redirect to start page if progress is invalid + + def is_valid_start_path(self, path: str): + if path == reverse("start"): + return True + if path.startswith("/admin"): + return True + return False def is_valid_progress(self, request): if request.session.get("registration_data") is None: