|
2 | 2 | from django.contrib import admin |
3 | 3 | from django.http import HttpResponse, HttpResponseRedirect |
4 | 4 | from django.shortcuts import render |
5 | | -from django.urls import include, re_path |
| 5 | +from django.urls import include, path, re_path |
6 | 6 | from testapp import views |
7 | 7 |
|
8 | 8 |
|
9 | 9 | pages_urlpatterns = ( |
10 | 10 | [ |
11 | | - re_path( |
12 | | - r"^$", lambda request: HttpResponseRedirect("/%s/" % request.LANGUAGE_CODE) |
13 | | - ), |
| 11 | + path("", lambda request: HttpResponseRedirect("/%s/" % request.LANGUAGE_CODE)), |
14 | 12 | re_path(r"^(?P<path>[-\w/]+)/$", views.page_detail, name="page"), |
15 | | - re_path(r"^$", views.page_detail, name="root"), |
| 13 | + path("", views.page_detail, name="root"), |
16 | 14 | ], |
17 | 15 | "pages", |
18 | 16 | ) |
19 | 17 |
|
20 | 18 |
|
21 | 19 | urlpatterns = i18n_patterns( |
22 | | - re_path(r"^i18n/$", lambda request: HttpResponse(request.LANGUAGE_CODE)) |
| 20 | + path("i18n/", lambda request: HttpResponse(request.LANGUAGE_CODE)) |
23 | 21 | ) + [ |
24 | 22 | re_path(r"^admin/", admin.site.urls), |
25 | | - re_path(r"^404/$", lambda request: render(request, "404.html")), |
| 23 | + path("404/", lambda request: render(request, "404.html")), |
26 | 24 | re_path(r"", include(pages_urlpatterns)), |
27 | 25 | ] |
0 commit comments