diff --git a/HISTORY.rst b/HISTORY.rst index a9c3b75..b365038 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,7 @@ Unreleased * Remove unsupported Django code * Added ``__str__()`` definitions for models +* Use path instead of re_path for some URLs 0.8.6 ----- diff --git a/docs/topics/custom.validation.rst b/docs/topics/custom.validation.rst index db0b592..5a8a0f0 100644 --- a/docs/topics/custom.validation.rst +++ b/docs/topics/custom.validation.rst @@ -68,6 +68,6 @@ URL pattern needs to be added to a project's ``URLconf``:: from your_app.forms import CustomPasswordPoliciesForm - urlpatterns = patterns('', - (r'^password/reset/', PasswordResetConfirmView.as_view(form_class=CustomPasswordPoliciesForm)), - ) + urlpatterns = [ + path("password/reset/", PasswordResetConfirmView.as_view(form_class=CustomPasswordPoliciesForm)), + ] diff --git a/password_policies/tests/urls.py b/password_policies/tests/urls.py index 4371bed..03fd8f5 100644 --- a/password_policies/tests/urls.py +++ b/password_policies/tests/urls.py @@ -1,21 +1,9 @@ -try: - from django.conf.urls import include, url -except ImportError: - from django.urls import include - from django.urls import re_path as url - -try: - from django.conf.urls import patterns -except ImportError: - patterns = False +from django.urls import include, path from password_policies.tests.views import TestHomeView, TestLoggedOutMixinView urlpatterns = [ - url(r"^password/", include("password_policies.urls")), - url(r"^$", TestHomeView.as_view(), name="home"), - url(r"^fubar/", TestLoggedOutMixinView.as_view(), name="loggedoutmixin"), + path("password/", include("password_policies.urls")), + path("", TestHomeView.as_view(), name="home"), + path("fubar/", TestLoggedOutMixinView.as_view(), name="loggedoutmixin"), ] - -if patterns: - urlpatterns = patterns("", *urlpatterns) # noqa diff --git a/password_policies/urls.py b/password_policies/urls.py index 8d2e5f6..430e1ea 100644 --- a/password_policies/urls.py +++ b/password_policies/urls.py @@ -1,4 +1,4 @@ -from django.urls import re_path as url +from django.urls import path, re_path from password_policies.views import ( PasswordChangeDoneView, @@ -10,20 +10,18 @@ ) urlpatterns = [ - url( - r"^change/done/$", PasswordChangeDoneView.as_view(), name="password_change_done" - ), - url(r"^change/$", PasswordChangeFormView.as_view(), name="password_change"), - url(r"^reset/$", PasswordResetFormView.as_view(), name="password_reset"), - url( - r"^reset/complete/$", + path("change/done/", PasswordChangeDoneView.as_view(), name="password_change_done"), + path("change/", PasswordChangeFormView.as_view(), name="password_change"), + path("reset/", PasswordResetFormView.as_view(), name="password_reset"), + path( + "reset/complete/", PasswordResetCompleteView.as_view(), name="password_reset_complete", ), - url( + re_path( r"^reset/confirm/([0-9A-Za-z_\-]+)/([0-9A-Za-z]{1,13})/([0-9A-Za-z-=_]{1,128})/$", PasswordResetConfirmView.as_view(), name="password_reset_confirm", ), - url(r"^reset/done/$", PasswordResetDoneView.as_view(), name="password_reset_done"), + path("reset/done/", PasswordResetDoneView.as_view(), name="password_reset_done"), ]