Merge pull request #119 from mohmyo/master

Use path() and re_path() instead of the deprecated url()
This commit is contained in:
Michael 2020-08-07 22:22:42 -05:00 committed by GitHub
commit 0b59a88d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 18 deletions

View File

@ -1,11 +1,11 @@
from django.conf.urls import url from django.urls import path, re_path
from django.views.generic import TemplateView from django.views.generic import TemplateView
from .views import RegisterView, VerifyEmailView from .views import RegisterView, VerifyEmailView
urlpatterns = [ urlpatterns = [
url(r'^$', RegisterView.as_view(), name='rest_register'), path('', RegisterView.as_view(), name='rest_register'),
url(r'^verify-email/$', VerifyEmailView.as_view(), name='rest_verify_email'), path('verify-email/', VerifyEmailView.as_view(), name='rest_verify_email'),
# This url is used by django-allauth and empty TemplateView is # This url is used by django-allauth and empty TemplateView is
# defined just to allow reverse() call inside app, for example when email # defined just to allow reverse() call inside app, for example when email
@ -18,6 +18,6 @@ urlpatterns = [
# If you don't want to use API on that step, then just use ConfirmEmailView # If you don't want to use API on that step, then just use ConfirmEmailView
# view from: # view from:
# django-allauth https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py # django-allauth https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py
url(r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(), re_path(r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(),
name='account_confirm_email'), name='account_confirm_email'),
] ]

View File

@ -1,20 +1,20 @@
from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView, from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView,
PasswordResetConfirmView, PasswordResetView, PasswordResetConfirmView, PasswordResetView,
UserDetailsView) UserDetailsView)
from django.conf.urls import url from django.urls import path
from django.conf import settings from django.conf import settings
urlpatterns = [ urlpatterns = [
# URLs that do not require a session or valid token # URLs that do not require a session or valid token
url(r'^password/reset/$', PasswordResetView.as_view(), path('password/reset/', PasswordResetView.as_view(),
name='rest_password_reset'), name='rest_password_reset'),
url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), path('password/reset/confirm/', PasswordResetConfirmView.as_view(),
name='rest_password_reset_confirm'), name='rest_password_reset_confirm'),
url(r'^login/$', LoginView.as_view(), name='rest_login'), path('login/', LoginView.as_view(), name='rest_login'),
# URLs that require a user to be logged in with a valid session / token. # URLs that require a user to be logged in with a valid session / token.
url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), path('logout/', LogoutView.as_view(), name='rest_logout'),
url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), path('user/', UserDetailsView.as_view(), name='rest_user_details'),
url(r'^password/change/$', PasswordChangeView.as_view(), path('password/change/', PasswordChangeView.as_view(),
name='rest_password_change'), name='rest_password_change'),
] ]
@ -24,6 +24,6 @@ if getattr(settings, 'REST_USE_JWT', False):
) )
urlpatterns += [ urlpatterns += [
url(r'^token/verify/$', TokenVerifyView.as_view(), name='token_verify'), path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
url(r'^token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'), path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
] ]

View File

@ -27,8 +27,8 @@ setup(
keywords='django rest auth registration rest-framework django-registration api', keywords='django rest auth registration rest-framework django-registration api',
zip_safe=False, zip_safe=False,
install_requires=[ install_requires=[
'Django>=1.11', 'Django>=2.0',
'djangorestframework>=3.1.3', 'djangorestframework>=3.7.0',
], ],
extras_require={ extras_require={
'with_social': ['django-allauth>=0.25.0'], 'with_social': ['django-allauth>=0.25.0'],