From cc41dedbc593b9de054ebee52ecc2df581da3d38 Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Fri, 29 Apr 2022 16:21:26 +0530 Subject: [PATCH] Address RemovedInDjango40Warning In Django 3.1, django.conf.urls.url() is deprecated in favor of django.urls.re_path(). For more info see [1] These were already replaced in Horizon repo by [2]. [1] https://docs.djangoproject.com/en/4.0/releases/3.1/#id2 [2] https://review.opendev.org/c/openstack/horizon/+/827093 Change-Id: I66118c1af551e69a2deabf87b37efa574233e93b --- disaster_recovery/actions/urls.py | 16 +++++++-------- disaster_recovery/api/rest/urls.py | 12 ++++++----- disaster_recovery/backups/urls.py | 13 ++++++------ disaster_recovery/clients/urls.py | 10 +++++----- disaster_recovery/jobs/urls.py | 32 +++++++++++++++--------------- disaster_recovery/sessions/urls.py | 26 ++++++++++++------------ disaster_recovery/urls.py | 4 ++-- 7 files changed, 58 insertions(+), 55 deletions(-) diff --git a/disaster_recovery/actions/urls.py b/disaster_recovery/actions/urls.py index 78be377..1af550f 100644 --- a/disaster_recovery/actions/urls.py +++ b/disaster_recovery/actions/urls.py @@ -12,18 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.actions import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^$', views.IndexView.as_view(), name='index'), - url(r'^create/(?P[^/]+)?$', - views.ActionWorkflowView.as_view(), - name='create'), + re_path(r'^create/(?P[^/]+)?$', + views.ActionWorkflowView.as_view(), + name='create'), - url(r'^action/(?P[^/]+)?$', - views.ActionView.as_view(), - name='action'), + re_path(r'^action/(?P[^/]+)?$', + views.ActionView.as_view(), + name='action'), ] diff --git a/disaster_recovery/api/rest/urls.py b/disaster_recovery/api/rest/urls.py index 667807b..404e844 100644 --- a/disaster_recovery/api/rest/urls.py +++ b/disaster_recovery/api/rest/urls.py @@ -16,13 +16,15 @@ URL patterns for the OpenStack Dashboard. """ -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.api.rest import rest_api urlpatterns = [ - url(r'^api/clients/$', rest_api.Clients.as_view(), name="api_clients"), - url(r'^api/actions/$', rest_api.ActionList.as_view(), name="api_actions"), - url(r'^api/actions/job/(?P[^/]+)?$', - rest_api.Actions.as_view(), name="api_actions_in_job"), + re_path(r'^api/clients/$', rest_api.Clients.as_view(), + name="api_clients"), + re_path(r'^api/actions/$', rest_api.ActionList.as_view(), + name="api_actions"), + re_path(r'^api/actions/job/(?P[^/]+)?$', + rest_api.Actions.as_view(), name="api_actions_in_job"), ] diff --git a/disaster_recovery/backups/urls.py b/disaster_recovery/backups/urls.py index ab12a8c..b7da993 100644 --- a/disaster_recovery/backups/urls.py +++ b/disaster_recovery/backups/urls.py @@ -13,15 +13,16 @@ # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.backups import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^(?P[^/]*)$', views.DetailView.as_view(), name='detail'), - url(r'^restore/(?P.*)$', - views.RestoreView.as_view(), - name='restore'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^(?P[^/]*)$', views.DetailView.as_view(), + name='detail'), + re_path(r'^restore/(?P.*)$', + views.RestoreView.as_view(), + name='restore'), ] diff --git a/disaster_recovery/clients/urls.py b/disaster_recovery/clients/urls.py index c634906..335b236 100644 --- a/disaster_recovery/clients/urls.py +++ b/disaster_recovery/clients/urls.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.clients import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^$', views.IndexView.as_view(), name='index'), - url(r'^(?P[^/]+)?$', - views.ClientView.as_view(), - name='client'), + re_path(r'^(?P[^/]+)?$', + views.ClientView.as_view(), + name='client'), ] diff --git a/disaster_recovery/jobs/urls.py b/disaster_recovery/jobs/urls.py index 7757dc0..2ac6e34 100644 --- a/disaster_recovery/jobs/urls.py +++ b/disaster_recovery/jobs/urls.py @@ -12,27 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.jobs import views urlpatterns = [ - url(r'^(?P[^/]+)?$', - views.JobsView.as_view(), - name='index'), + re_path(r'^(?P[^/]+)?$', + views.JobsView.as_view(), + name='index'), - url(r'^create/$', - views.JobWorkflowView.as_view(), - name='create'), + re_path(r'^create/$', + views.JobWorkflowView.as_view(), + name='create'), - url(r'^configure/(?P[^/]+)?$', - views.JobWorkflowView.as_view(), - name='configure'), + re_path(r'^configure/(?P[^/]+)?$', + views.JobWorkflowView.as_view(), + name='configure'), - url(r'^edit/(?P[^/]+)?$', - views.EditJobWorkflowView.as_view(), - name='edit_job'), + re_path(r'^edit/(?P[^/]+)?$', + views.EditJobWorkflowView.as_view(), + name='edit_job'), - url(r'^edit_actions/(?P[^/]+)?$', - views.ActionsInJobView.as_view(), - name='edit_action'), + re_path(r'^edit_actions/(?P[^/]+)?$', + views.ActionsInJobView.as_view(), + name='edit_action'), ] diff --git a/disaster_recovery/sessions/urls.py b/disaster_recovery/sessions/urls.py index 6eb41f7..25547eb 100644 --- a/disaster_recovery/sessions/urls.py +++ b/disaster_recovery/sessions/urls.py @@ -12,25 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from disaster_recovery.sessions import views urlpatterns = [ - url(r'^(?P[^/]+)?$', - views.SessionsView.as_view(), - name='index'), + re_path(r'^(?P[^/]+)?$', + views.SessionsView.as_view(), + name='index'), - url(r'^attach_to_session/(?P[^/]+)?$', - views.AttachToSessionWorkflow.as_view(), - name='attach'), + re_path(r'^attach_to_session/(?P[^/]+)?$', + views.AttachToSessionWorkflow.as_view(), + name='attach'), - url(r'^create/$', - views.CreateSessionWorkflow.as_view(), - name='create'), + re_path(r'^create/$', + views.CreateSessionWorkflow.as_view(), + name='create'), - url(r'^edit/(?P[^/]+)?$', - views.CreateSessionWorkflow.as_view(), - name='edit'), + re_path(r'^edit/(?P[^/]+)?$', + views.CreateSessionWorkflow.as_view(), + name='edit'), ] diff --git a/disaster_recovery/urls.py b/disaster_recovery/urls.py index 5fc08e8..0babea3 100644 --- a/disaster_recovery/urls.py +++ b/disaster_recovery/urls.py @@ -13,10 +13,10 @@ # limitations under the License. from django.conf.urls import include -from django.conf.urls import url +from django.urls import re_path import disaster_recovery.api.rest.urls as rest_urls urlpatterns = [ - url(r'', include(rest_urls)), + re_path(r'', include(rest_urls)), ]