|
10 | 10 | django/1.41a |
11 | 11 | django/1.41a/core |
12 | 12 | django/1.41a/core/DjangoRuntimeWarning |
13 | | -
|
14 | 13 | """ |
15 | 14 |
|
16 | | -from django.urls import path, re_path, reverse_lazy |
| 15 | +from django.urls import path, reverse_lazy |
17 | 16 | from django.views.generic import RedirectView |
18 | 17 |
|
19 | 18 | from cbv import views |
20 | 19 |
|
21 | 20 |
|
22 | 21 | urlpatterns = [ |
23 | 22 | path("", RedirectView.as_view(url=reverse_lazy("home"))), |
24 | | - re_path( |
25 | | - r"^(?P<package>[\w-]+)/$", |
| 23 | + path( |
| 24 | + "<slug:package>/", |
26 | 25 | views.RedirectToLatestVersionView.as_view(), |
27 | 26 | {"url_name": "version-detail"}, |
28 | 27 | ), |
29 | | - re_path( |
30 | | - r"^(?P<package>[\w-]+)/latest/$", |
| 28 | + path( |
| 29 | + "<slug:package>/latest/", |
31 | 30 | views.RedirectToLatestVersionView.as_view(), |
32 | 31 | {"url_name": "version-detail"}, |
33 | 32 | name="latest-version-detail", |
34 | 33 | ), |
35 | | - re_path( |
36 | | - r"^(?P<package>[\w-]+)/(?P<version>[^/]+)/$", |
| 34 | + path( |
| 35 | + "<slug:package>/<str:version>/", |
37 | 36 | views.VersionDetailView.as_view(), |
38 | 37 | name="version-detail", |
39 | 38 | ), |
40 | | - re_path( |
41 | | - r"^(?P<package>[\w-]+)/latest/(?P<module>[\w\.]+)/$", |
| 39 | + path( |
| 40 | + "<slug:package>/latest/<str:module>/", |
42 | 41 | views.RedirectToLatestVersionView.as_view(), |
43 | 42 | {"url_name": "module-detail"}, |
44 | 43 | name="latest-module-detail", |
45 | 44 | ), |
46 | | - re_path( |
47 | | - r"^(?P<package>[\w-]+)/(?P<version>[^/]+)/(?P<module>[\w\.]+)/$", |
| 45 | + path( |
| 46 | + "<slug:package>/<str:version>/<str:module>/", |
48 | 47 | views.ModuleDetailView.as_view(), |
49 | 48 | name="module-detail", |
50 | 49 | ), |
51 | | - re_path( |
52 | | - r"^(?P<package>[\w-]+)/latest/(?P<module>[\w\.]+)/(?P<klass>[\w]+)/$", |
| 50 | + path( |
| 51 | + "<slug:package>/latest/<str:module>/<str:klass>/", |
53 | 52 | views.RedirectToLatestVersionView.as_view(), |
54 | 53 | {"url_name": "klass-detail"}, |
55 | 54 | name="latest-klass-detail", |
56 | 55 | ), |
57 | | - re_path( |
58 | | - r"^(?P<package>[\w-]+)/(?P<version>[^/]+)/(?P<module>[\w\.]+)/(?P<klass>[\w]+)/$", |
| 56 | + path( |
| 57 | + "<slug:package>/<str:version>/<str:module>/<str:klass>/", |
59 | 58 | views.KlassDetailView.as_view(), |
60 | 59 | name="klass-detail", |
61 | 60 | ), |
|
0 commit comments