Skip to content

Commit 2880504

Browse files
author
Jaap Roes
committed
Simplify how urlpatterns are loaded in docs
1 parent 1de079b commit 2880504

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

Diff for: README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ Add ``oauth2_provider`` to your ``INSTALLED_APPS``
6565
6666
6767
If you need an OAuth2 provider you'll want to add the following to your ``urls.py``.
68-
Notice that ``oauth2_provider`` namespace is mandatory.
6968

7069
.. code-block:: python
7170
71+
from oauth2_provider import urls as oauth2_urls
72+
7273
urlpatterns = [
7374
...
74-
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
75+
path('o/', include(oauth2_urls)),
7576
]
7677
7778
Changelog

Diff for: docs/getting_started.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,11 @@ Include ``oauth2_provider.urls`` to :file:`iam/urls.py` as follows:
191191
192192
from django.contrib import admin
193193
from django.urls import include, path
194+
from oauth2_provider import urls as oauth2_urls
194195
195196
urlpatterns = [
196197
path('admin/', admin.site.urls),
197-
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
198+
path('o/', include(oauth2_urls)),
198199
]
199200
200201
This will make available endpoints to authorize, generate token and create OAuth applications.

Diff for: docs/install.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ If you need an OAuth2 provider you'll want to add the following to your :file:`u
2020
.. code-block:: python
2121
2222
from django.urls import include, path
23+
from oauth2_provider import urls as oauth2_urls
2324
2425
urlpatterns = [
2526
...
26-
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
27+
path('o/', include(oauth2_urls),
2728
]
2829
2930
Sync your database

Diff for: docs/rest-framework/getting_started.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Here's our project's root :file:`urls.py` module:
5252
from rest_framework import generics, permissions, serializers
5353
5454
from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope, TokenHasScope
55+
from oauth2_provider import urls as oauth2_urls
5556
5657
# first we define the serializers
5758
class UserSerializer(serializers.ModelSerializer):
@@ -84,7 +85,7 @@ Here's our project's root :file:`urls.py` module:
8485
# Setup the URLs and include login URLs for the browsable API.
8586
urlpatterns = [
8687
path('admin/', admin.site.urls),
87-
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
88+
path('o/', include(oauth2_urls)),
8889
path('users/', UserList.as_view()),
8990
path('users/<pk>/', UserDetails.as_view()),
9091
path('groups/', GroupList.as_view()),

Diff for: docs/tutorial/tutorial_01.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ Include the Django OAuth Toolkit urls in your `urls.py`, choosing the urlspace y
3434
.. code-block:: python
3535
3636
from django.urls import path, include
37+
from oauth2_provider import urls as oauth2_urls
3738
3839
urlpatterns = [
3940
path("admin", admin.site.urls),
40-
path("o/", include('oauth2_provider.urls', namespace='oauth2_provider')),
41+
path("o/", include(oauth2_urls)),
4142
# ...
4243
]
4344

0 commit comments

Comments
 (0)