diff --git a/docs/index.rst b/docs/index.rst index 87d2935..abb9bff 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -83,7 +83,7 @@ add the middleware, configure the urls and point to the correct login page. urlpatterns = [ ... - url(r'^keycloak/', include('django_keycloak.urls')), + re_path(r'^keycloak/', include('django_keycloak.urls')), ] diff --git a/example/resource-provider-api/myapp/urls.py b/example/resource-provider-api/myapp/urls.py index 047f134..870ffe3 100644 --- a/example/resource-provider-api/myapp/urls.py +++ b/example/resource-provider-api/myapp/urls.py @@ -5,22 +5,22 @@ Examples: Function views 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', Home.as_view(), name='home') Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) + 1. Import the include() function: from django.urls import url, include + 2. Add a URL to urlpatterns: re_path(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url, include +from django.urls import re_path, include from django.contrib import admin from myapp import views urlpatterns = [ - url(r'^api/end-point$', views.api_end_point), - url(r'^api/authenticated-end-point$', views.authenticated_end_point), - url(r'^admin/', admin.site.urls), + re_path(r'^api/end-point$', views.api_end_point), + re_path(r'^api/authenticated-end-point$', views.authenticated_end_point), + re_path(r'^admin/', admin.site.urls), ] diff --git a/example/resource-provider/myapp/urls.py b/example/resource-provider/myapp/urls.py index cdfbb3a..c54bfc3 100644 --- a/example/resource-provider/myapp/urls.py +++ b/example/resource-provider/myapp/urls.py @@ -5,24 +5,24 @@ Examples: Function views 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', Home.as_view(), name='home') Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) + 1. Import the include() function: from django.urls import url, include + 2. Add a URL to urlpatterns: re_path(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url, include +from django.urls import re_path, include from django.contrib import admin from myapp import views urlpatterns = [ - url(r'^$', views.Home.as_view(), name='index'), - url(r'^secured$', views.Secured.as_view(), name='secured'), - url(r'^permission$', views.Permission.as_view(), name='permission'), - url(r'^keycloak/', include('django_keycloak.urls')), - url(r'^admin/', admin.site.urls), + re_path(r'^$', views.Home.as_view(), name='index'), + re_path(r'^secured$', views.Secured.as_view(), name='secured'), + re_path(r'^permission$', views.Permission.as_view(), name='permission'), + re_path(r'^keycloak/', include('django_keycloak.urls')), + re_path(r'^admin/', admin.site.urls), ] diff --git a/src/django_keycloak/urls.py b/src/django_keycloak/urls.py index 1486ed0..235758c 100644 --- a/src/django_keycloak/urls.py +++ b/src/django_keycloak/urls.py @@ -5,23 +5,23 @@ Examples: Function views 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') + 2. Add a URL to urlpatterns: re_path(r'^$', Home.as_view(), name='home') Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) + 1. Import the include() function: from django.urls import url, include + 2. Add a URL to urlpatterns: re_path(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.urls import re_path from django_keycloak import views urlpatterns = [ - url(r'^login$', views.Login.as_view(), name='keycloak_login'), - url(r'^login-complete$', views.LoginComplete.as_view(), + re_path(r'^login$', views.Login.as_view(), name='keycloak_login'), + re_path(r'^login-complete$', views.LoginComplete.as_view(), name='keycloak_login_complete'), - url(r'^logout$', views.Logout.as_view(), name='keycloak_logout'), - url(r'^session-iframe', views.SessionIframe.as_view(), + re_path(r'^logout$', views.Logout.as_view(), name='keycloak_logout'), + re_path(r'^session-iframe', views.SessionIframe.as_view(), name='keycloak_session_iframe') ]