Skip to content

Commit fb6f340

Browse files
vjMagarauvipy
authored andcommitted
Updated 'url' with 'path' in documentation
1 parent 28f3f5e commit fb6f340

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

docs/install.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ If you need an OAuth2 provider you'll want to add the following to your urls.py
2121
2222
urlpatterns = [
2323
...
24-
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
24+
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
25+
26+
# using re_path
27+
re_path(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
2528
]
2629
2730
Sync your database

docs/tutorial/tutorial_01.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Include the Django OAuth Toolkit urls in your `urls.py`, choosing the urlspace y
3434
.. code-block:: python
3535
3636
urlpatterns = [
37-
url(r"^admin/", admin.site.urls),
38-
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
37+
path("admin", admin.site.urls),
38+
path("o/", include('oauth2_provider.urls', namespace='oauth2_provider')),
3939
# ...
4040
]
4141

docs/tutorial/tutorial_02.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,32 @@ URL this view will respond to:
4141
4242
# OAuth2 provider endpoints
4343
oauth2_endpoint_views = [
44-
url(r'^authorize/$', oauth2_views.AuthorizationView.as_view(), name="authorize"),
45-
url(r'^token/$', oauth2_views.TokenView.as_view(), name="token"),
46-
url(r'^revoke-token/$', oauth2_views.RevokeTokenView.as_view(), name="revoke-token"),
44+
path('authorize/', oauth2_views.AuthorizationView.as_view(), name="authorize"),
45+
path('token/', oauth2_views.TokenView.as_view(), name="token"),
46+
path('revoke-token/', oauth2_views.RevokeTokenView.as_view(), name="revoke-token"),
4747
]
4848
4949
if settings.DEBUG:
5050
# OAuth2 Application Management endpoints
5151
oauth2_endpoint_views += [
52-
url(r'^applications/$', oauth2_views.ApplicationList.as_view(), name="list"),
53-
url(r'^applications/register/$', oauth2_views.ApplicationRegistration.as_view(), name="register"),
54-
url(r'^applications/(?P<pk>\d+)/$', oauth2_views.ApplicationDetail.as_view(), name="detail"),
55-
url(r'^applications/(?P<pk>\d+)/delete/$', oauth2_views.ApplicationDelete.as_view(), name="delete"),
56-
url(r'^applications/(?P<pk>\d+)/update/$', oauth2_views.ApplicationUpdate.as_view(), name="update"),
52+
path('applications/', oauth2_views.ApplicationList.as_view(), name="list"),
53+
path('applications/register/', oauth2_views.ApplicationRegistration.as_view(), name="register"),
54+
path('applications/<pk>/', oauth2_views.ApplicationDetail.as_view(), name="detail"),
55+
path('applications/<pk>/delete/', oauth2_views.ApplicationDelete.as_view(), name="delete"),
56+
path('applications/<pk>/update/', oauth2_views.ApplicationUpdate.as_view(), name="update"),
5757
]
5858
5959
# OAuth2 Token Management endpoints
6060
oauth2_endpoint_views += [
61-
url(r'^authorized-tokens/$', oauth2_views.AuthorizedTokensListView.as_view(), name="authorized-token-list"),
62-
url(r'^authorized-tokens/(?P<pk>\d+)/delete/$', oauth2_views.AuthorizedTokenDeleteView.as_view(),
61+
path('authorized-tokens/', oauth2_views.AuthorizedTokensListView.as_view(), name="authorized-token-list"),
62+
path('authorized-tokens/<pk>/delete/', oauth2_views.AuthorizedTokenDeleteView.as_view(),
6363
name="authorized-token-delete"),
6464
]
6565
6666
urlpatterns = [
6767
# OAuth 2 endpoints:
68-
url(r'^o/', include(oauth2_endpoint_views, namespace="oauth2_provider")),
69-
url(r'^api/hello', ApiEndpoint.as_view()), # an example resource endpoint
68+
path('o/', include(oauth2_endpoint_views, namespace="oauth2_provider")),
69+
path('api/hello', ApiEndpoint.as_view()), # an example resource endpoint
7070
]
7171
7272
You will probably want to write your own application views to deal with permissions and access control but the ones packaged with the library can get you started when developing the app.

docs/tutorial/tutorial_03.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ To check everything works properly, mount the view above to some url:
7474
.. code-block:: python
7575
7676
urlpatterns = [
77-
url(r'^secret$', 'my.views.secret_page', name='secret'),
77+
path('secret', 'my.views.secret_page', name='secret'),
7878
'...',
7979
]
8080

0 commit comments

Comments
 (0)