From d35daf8600a66c0ff20e36f82969df61a7fc4981 Mon Sep 17 00:00:00 2001 From: kundan223 Date: Sun, 14 Dec 2025 13:02:25 +0530 Subject: [6.0.x] Fixed #36796 -- Handled lazy routes correctly in RoutePattern.match(). Coerce lazy route values to `str` at match time to support prefix and endpoint matching when using `gettext_lazy()` route paths. Regression in f920937c8a63df6bea220e4386f59cdb45b2e355. Thanks to Andrea Angelini for the report, and to Jake Howard and Jacob Walls for reviews. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> Backport of 7bf3ac3ee255bcfe329e3203c7a2555b1275d506 from main. --- django/urls/resolvers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django') diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index bad5490dcb..6c681f9d8d 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -341,8 +341,8 @@ class RoutePattern(CheckURLMixin): if self._route == path: return "", (), {} # If this isn't an endpoint, the path should start with the route. - elif path.startswith(self._route): - return path.removeprefix(self._route), (), {} + elif path.startswith(route := str(self._route)): + return path.removeprefix(route), (), {} return None def check(self): -- cgit v1.3