You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace re_path with path where possible in urls.py #3515
NAV has tons of re_path since it is a rename from the old way of doing urls in django, using the url function. It was a seddable fix.
However, modern django also has path, which is not written as a regular expression but has its own syntax, covering the most common cases. It is possible to autoconvert some re_paths to path but of course, NAV has some oddities. also some that cannot be handled with path-syntax at all.
This issue is for collecting PRs that only change re_path to path, merged to the branch path-instead-of-repath. Multiple PR's because otherwise not only making these PR's but also reviewing the PR's would be a snore-inducing, eye-strain-creating chore.
If you need a chore, pick an urls.py or five that haven't been converted yet, claim it as yours by importing path in it (or some other miniscule change if path is already there), and make a draft PR with just that commit. Then you can convert at your leisure.
Each PR will finish at least one urls.py as much as possible, and we will not add any new path-syntax here, that's for #3548.
When all the easy pickings have landed, https://regex101.com/ is useful to compare regexpes in order to simplify them. For instance, re_path(r'(?P<id>\d+)$' and re_path(r'(?P<id>[\d]+)$' are equivalent to path('<int:id>) but re_path(r'^(?P<id>(\d+))$' is not and it is necessary to check what the view does in order to ascertain if the simplification is possible.
Activity
hmpf commentedon Sep 17, 2025
When all the easy pickings have landed, https://regex101.com/ is useful to compare regexpes in order to simplify them. For instance,
re_path(r'(?P<id>\d+)$'andre_path(r'(?P<id>[\d]+)$'are equivalent topath('<int:id>)butre_path(r'^(?P<id>(\d+))$'is not and it is necessary to check what the view does in order to ascertain if the simplification is possible.