From 0c601c22eba7ccc328d4ddf3dcdb64ceaaee13e1 Mon Sep 17 00:00:00 2001 From: Robin <23118399+robinheidrich@users.noreply.github.com> Date: Mon, 6 Jan 2025 01:58:45 +0100 Subject: [PATCH] Fix active state matching for nested URLs --- pmaweb/context_processors.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pmaweb/context_processors.py b/pmaweb/context_processors.py index 99438f21..bfcb722d 100644 --- a/pmaweb/context_processors.py +++ b/pmaweb/context_processors.py @@ -60,10 +60,13 @@ def menu(request): else: urlname = 'home' - active = ( - request.resolver_match and - urlname == request.resolver_match.url_name - ) + if urlname == 'home': + active = request.path == reverse(urlname) + else: + active = ( + request.resolver_match and + request.path.startswith(reverse(urlname)) + ) result.append({ 'title': title,