|
1 | 1 | from django.conf import settings
|
2 |
| -from django.conf.urls import include, url |
3 |
| -from django.urls import path |
| 2 | +from django.urls import include, path, re_path |
4 | 3 | from django.views.generic import TemplateView
|
5 | 4 | from rest_framework import routers
|
6 | 5 | from rest_framework.schemas import get_schema_view
|
|
36 | 35 | router.register(r"lab-results", LabResultViewSet)
|
37 | 36 |
|
38 | 37 | urlpatterns = [
|
39 |
| - url(r"^", include(router.urls)), |
40 |
| - url( |
| 38 | + path("", include(router.urls)), |
| 39 | + re_path( |
41 | 40 | r"^entries/(?P<entry_pk>[^/.]+)/suggested/$",
|
42 | 41 | EntryViewSet.as_view({"get": "list"}),
|
43 | 42 | name="entry-suggested",
|
44 | 43 | ),
|
45 |
| - url( |
| 44 | + re_path( |
46 | 45 | r"entries/(?P<entry_pk>[^/.]+)/blog$",
|
47 | 46 | BlogViewSet.as_view({"get": "retrieve"}),
|
48 | 47 | name="entry-blog",
|
49 | 48 | ),
|
50 |
| - url( |
| 49 | + re_path( |
51 | 50 | r"entries/(?P<entry_pk>[^/.]+)/comments$",
|
52 | 51 | CommentViewSet.as_view({"get": "list"}),
|
53 | 52 | name="entry-comments",
|
54 | 53 | ),
|
55 |
| - url( |
| 54 | + re_path( |
56 | 55 | r"entries/(?P<entry_pk>[^/.]+)/authors$",
|
57 | 56 | AuthorViewSet.as_view({"get": "list"}),
|
58 | 57 | name="entry-authors",
|
59 | 58 | ),
|
60 |
| - url( |
| 59 | + re_path( |
61 | 60 | r"entries/(?P<entry_pk>[^/.]+)/featured$",
|
62 | 61 | EntryViewSet.as_view({"get": "retrieve"}),
|
63 | 62 | name="entry-featured",
|
64 | 63 | ),
|
65 |
| - url( |
| 64 | + re_path( |
66 | 65 | r"^authors/(?P<pk>[^/.]+)/(?P<related_field>\w+)/$",
|
67 | 66 | AuthorViewSet.as_view({"get": "retrieve_related"}),
|
68 | 67 | name="author-related",
|
69 | 68 | ),
|
70 |
| - url( |
| 69 | + re_path( |
71 | 70 | r"^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)$",
|
72 | 71 | EntryRelationshipView.as_view(),
|
73 | 72 | name="entry-relationships",
|
74 | 73 | ),
|
75 |
| - url( |
| 74 | + re_path( |
76 | 75 | r"^blogs/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)$",
|
77 | 76 | BlogRelationshipView.as_view(),
|
78 | 77 | name="blog-relationships",
|
79 | 78 | ),
|
80 |
| - url( |
| 79 | + re_path( |
81 | 80 | r"^comments/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)$",
|
82 | 81 | CommentRelationshipView.as_view(),
|
83 | 82 | name="comment-relationships",
|
84 | 83 | ),
|
85 |
| - url( |
| 84 | + re_path( |
86 | 85 | r"^authors/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)$",
|
87 | 86 | AuthorRelationshipView.as_view(),
|
88 | 87 | name="author-relationships",
|
|
111 | 110 | import debug_toolbar
|
112 | 111 |
|
113 | 112 | urlpatterns = [
|
114 |
| - url(r"^__debug__/", include(debug_toolbar.urls)), |
| 113 | + path("__debug__/", include(debug_toolbar.urls)), |
115 | 114 | ] + urlpatterns
|
0 commit comments