django.conf.urls is deprecated and will be removed in Django 4.0, use django.urls.re_path instead
Signed-off-by: Yohann D'ANELLO <ynerant@¢rans.org> Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
10b389e7be
commit
d62def6d6b
2 changed files with 35 additions and 14 deletions
|
@ -13,10 +13,20 @@ Including another URLconf
|
||||||
1. Import the include() function: from django.conf.urls import url, include, include
|
1. Import the include() function: from django.conf.urls import url, include, include
|
||||||
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import django
|
||||||
|
|
||||||
|
if django.VERSION < (2,):
|
||||||
|
from django.conf.urls import url
|
||||||
|
re_path = url
|
||||||
|
else:
|
||||||
|
from django.urls import re_path
|
||||||
|
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^admin/', admin.site.urls),
|
re_path(r'^admin/', admin.site.urls),
|
||||||
url(r'^', include('cas_server.urls', namespace='cas_server')),
|
re_path(r'^', include('cas_server.urls', namespace='cas_server')),
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,6 +10,16 @@
|
||||||
#
|
#
|
||||||
# (c) 2015-2016 Valentin Samir
|
# (c) 2015-2016 Valentin Samir
|
||||||
"""urls for the app"""
|
"""urls for the app"""
|
||||||
|
|
||||||
|
import django
|
||||||
|
|
||||||
|
if django.VERSION < (2,):
|
||||||
|
from django.conf.urls import url
|
||||||
|
re_path = url
|
||||||
|
else:
|
||||||
|
from django.urls import re_path
|
||||||
|
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
from django.views.decorators.debug import sensitive_post_parameters, sensitive_variables
|
from django.views.decorators.debug import sensitive_post_parameters, sensitive_variables
|
||||||
|
@ -19,42 +29,42 @@ from cas_server import views
|
||||||
app_name = "cas_server"
|
app_name = "cas_server"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(
|
re_path(
|
||||||
r'^$',
|
r'^$',
|
||||||
RedirectView.as_view(pattern_name="cas_server:login", permanent=False, query_string=True)
|
RedirectView.as_view(pattern_name="cas_server:login", permanent=False, query_string=True)
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
'^login$',
|
'^login$',
|
||||||
sensitive_post_parameters('password')(
|
sensitive_post_parameters('password')(
|
||||||
views.LoginView.as_view()
|
views.LoginView.as_view()
|
||||||
),
|
),
|
||||||
name='login'
|
name='login'
|
||||||
),
|
),
|
||||||
url('^logout$', views.LogoutView.as_view(), name='logout'),
|
re_path('^logout$', views.LogoutView.as_view(), name='logout'),
|
||||||
url('^validate$', views.Validate.as_view(), name='validate'),
|
re_path('^validate$', views.Validate.as_view(), name='validate'),
|
||||||
url(
|
re_path(
|
||||||
'^serviceValidate$',
|
'^serviceValidate$',
|
||||||
views.ValidateService.as_view(allow_proxy_ticket=False),
|
views.ValidateService.as_view(allow_proxy_ticket=False),
|
||||||
name='serviceValidate'
|
name='serviceValidate'
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
'^proxyValidate$',
|
'^proxyValidate$',
|
||||||
views.ValidateService.as_view(allow_proxy_ticket=True),
|
views.ValidateService.as_view(allow_proxy_ticket=True),
|
||||||
name='proxyValidate'
|
name='proxyValidate'
|
||||||
),
|
),
|
||||||
url('^proxy$', views.Proxy.as_view(), name='proxy'),
|
re_path('^proxy$', views.Proxy.as_view(), name='proxy'),
|
||||||
url(
|
re_path(
|
||||||
'^p3/serviceValidate$',
|
'^p3/serviceValidate$',
|
||||||
views.ValidateService.as_view(allow_proxy_ticket=False),
|
views.ValidateService.as_view(allow_proxy_ticket=False),
|
||||||
name='p3_serviceValidate'
|
name='p3_serviceValidate'
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
'^p3/proxyValidate$',
|
'^p3/proxyValidate$',
|
||||||
views.ValidateService.as_view(allow_proxy_ticket=True),
|
views.ValidateService.as_view(allow_proxy_ticket=True),
|
||||||
name='p3_proxyValidate'
|
name='p3_proxyValidate'
|
||||||
),
|
),
|
||||||
url('^samlValidate$', views.SamlValidate.as_view(), name='samlValidate'),
|
re_path('^samlValidate$', views.SamlValidate.as_view(), name='samlValidate'),
|
||||||
url(
|
re_path(
|
||||||
'^auth$',
|
'^auth$',
|
||||||
sensitive_variables('password', 'secret')(
|
sensitive_variables('password', 'secret')(
|
||||||
sensitive_post_parameters('password', 'secret')(
|
sensitive_post_parameters('password', 'secret')(
|
||||||
|
@ -63,5 +73,6 @@ urlpatterns = [
|
||||||
),
|
),
|
||||||
name='auth'
|
name='auth'
|
||||||
),
|
),
|
||||||
url("^federate(?:/(?P<provider>([^/]+)))?$", views.FederateAuth.as_view(), name='federateAuth'),
|
re_path("^federate(?:/(?P<provider>([^/]+)))?$",
|
||||||
|
views.FederateAuth.as_view(), name='federateAuth'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue