From 56a6e73deecc5632ed760032a3e214eb855f2f59 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 28 Jul 2022 16:36:03 +0200 Subject: [PATCH] Django 4: django.conf.urls.url is removed As per Django 4 release notes: https://docs.djangoproject.com/en/4.0/releases/4.0/ django.conf.urls.url is removed, and django.urls.re_path should be used instead. Change-Id: I01dbd7b4931f3fb13b0a77ced740113227cfcaef --- .../content/backup_strategies/urls.py | 6 +-- .../content/database_backups/urls.py | 10 ++-- .../content/database_clusters/urls.py | 34 ++++++------ .../content/database_configurations/urls.py | 26 ++++----- .../content/databases/logs/urls.py | 12 ++--- trove_dashboard/content/databases/urls.py | 53 ++++++++++--------- .../content/ng_database_backups/urls.py | 4 +- trove_dashboard/test/urls.py | 5 +- 8 files changed, 76 insertions(+), 74 deletions(-) diff --git a/trove_dashboard/content/backup_strategies/urls.py b/trove_dashboard/content/backup_strategies/urls.py index 7133291..b97e052 100644 --- a/trove_dashboard/content/backup_strategies/urls.py +++ b/trove_dashboard/content/backup_strategies/urls.py @@ -12,11 +12,11 @@ # 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 trove_dashboard.content.backup_strategies import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^create$', views.BackupStrategyView.as_view(), name='create'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^create$', views.BackupStrategyView.as_view(), name='create'), ] diff --git a/trove_dashboard/content/database_backups/urls.py b/trove_dashboard/content/database_backups/urls.py index 1f7555c..42bc916 100644 --- a/trove_dashboard/content/database_backups/urls.py +++ b/trove_dashboard/content/database_backups/urls.py @@ -12,13 +12,13 @@ # 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 trove_dashboard.content.database_backups import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^create$', views.BackupView.as_view(), name='create'), - url(r'^(?P[^/]+)/$', views.DetailView.as_view(), - name='detail'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^create$', views.BackupView.as_view(), name='create'), + re_path(r'^(?P[^/]+)/$', views.DetailView.as_view(), + name='detail'), ] diff --git a/trove_dashboard/content/database_clusters/urls.py b/trove_dashboard/content/database_clusters/urls.py index b08a955..460c47f 100644 --- a/trove_dashboard/content/database_clusters/urls.py +++ b/trove_dashboard/content/database_clusters/urls.py @@ -14,27 +14,27 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls import url # noqa +from django.urls import re_path # noqa from trove_dashboard.content.database_clusters import views CLUSTERS = r'^(?P[^/]+)/%s$' urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^launch$', views.LaunchClusterView.as_view(), name='launch'), - url(r'^(?P[^/]+)/$', views.DetailView.as_view(), - name='detail'), - url(CLUSTERS % 'cluster_grow_details', - views.ClusterGrowView.as_view(), - name='cluster_grow_details'), - url(CLUSTERS % 'add_instance', - views.ClusterAddInstancesView.as_view(), - name='add_instance'), - url(CLUSTERS % 'cluster_shrink_details', - views.ClusterShrinkView.as_view(), - name='cluster_shrink_details'), - url(CLUSTERS % 'reset_password', - views.ResetPasswordView.as_view(), - name='reset_password'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^launch$', views.LaunchClusterView.as_view(), name='launch'), + re_path(r'^(?P[^/]+)/$', views.DetailView.as_view(), + name='detail'), + re_path(CLUSTERS % 'cluster_grow_details', + views.ClusterGrowView.as_view(), + name='cluster_grow_details'), + re_path(CLUSTERS % 'add_instance', + views.ClusterAddInstancesView.as_view(), + name='add_instance'), + re_path(CLUSTERS % 'cluster_shrink_details', + views.ClusterShrinkView.as_view(), + name='cluster_shrink_details'), + re_path(CLUSTERS % 'reset_password', + views.ResetPasswordView.as_view(), + name='reset_password'), ] diff --git a/trove_dashboard/content/database_configurations/urls.py b/trove_dashboard/content/database_configurations/urls.py index 71085a5..fe00782 100644 --- a/trove_dashboard/content/database_configurations/urls.py +++ b/trove_dashboard/content/database_configurations/urls.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls import url # noqa +from django.urls import re_path # noqa from trove_dashboard.content.database_configurations \ import views @@ -22,16 +22,16 @@ CONFIGS = r'^(?P[^/]+)/%s$' urlpatterns = [ - url(r'^$', - views.IndexView.as_view(), - name='index'), - url(r'^create$', - views.CreateConfigurationView.as_view(), - name='create'), - url(CONFIGS % '', - views.DetailView.as_view(), - name='detail'), - url(CONFIGS % 'add', - views.AddParameterView.as_view(), - name='add') + re_path(r'^$', + views.IndexView.as_view(), + name='index'), + re_path(r'^create$', + views.CreateConfigurationView.as_view(), + name='create'), + re_path(CONFIGS % '', + views.DetailView.as_view(), + name='detail'), + re_path(CONFIGS % 'add', + views.AddParameterView.as_view(), + name='add') ] diff --git a/trove_dashboard/content/databases/logs/urls.py b/trove_dashboard/content/databases/logs/urls.py index 4326e7b..b65edab 100644 --- a/trove_dashboard/content/databases/logs/urls.py +++ b/trove_dashboard/content/databases/logs/urls.py @@ -12,16 +12,16 @@ # 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 trove_dashboard.content.databases.logs import views LOGS = r'^(?P[^/]+)/%s$' urlpatterns = [ - url(LOGS % 'console', views.console, name='console'), - url(LOGS % 'download_log', views.download_log, name='download_log'), - url(LOGS % 'full_log', views.full_log, name='full_log'), - url(LOGS % 'log_contents', - views.LogContentsView.as_view(), name='log_contents'), + re_path(LOGS % 'console', views.console, name='console'), + re_path(LOGS % 'download_log', views.download_log, name='download_log'), + re_path(LOGS % 'full_log', views.full_log, name='full_log'), + re_path(LOGS % 'log_contents', + views.LogContentsView.as_view(), name='log_contents'), ] diff --git a/trove_dashboard/content/databases/urls.py b/trove_dashboard/content/databases/urls.py index 6ae7bdc..ae5f478 100644 --- a/trove_dashboard/content/databases/urls.py +++ b/trove_dashboard/content/databases/urls.py @@ -13,7 +13,7 @@ # under the License. from django.conf.urls import include -from django.conf.urls import url +from django.urls import re_path from trove_dashboard.content.databases.logs import urls as logs_urls from trove_dashboard.content.databases import views @@ -25,29 +25,30 @@ USERS = r'^(?P[^/]+)/(?P[^/]+)/' \ urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^launch$', views.LaunchInstanceView.as_view(), name='launch'), - url(INSTANCES % '', views.DetailView.as_view(), name='detail'), - url(INSTANCES % 'edit_instance', views.UpdateInstanceView.as_view(), - name='edit_instance'), - url(INSTANCES % 'resize_volume', views.ResizeVolumeView.as_view(), - name='resize_volume'), - url(INSTANCES % 'resize_instance', views.ResizeInstanceView.as_view(), - name='resize_instance'), - url(INSTANCES % 'create_user', views.CreateUserView.as_view(), - name='create_user'), - url(USERS % 'edit_user', views.EditUserView.as_view(), - name='edit_user'), - url(USERS % 'access_detail', views.AccessDetailView.as_view(), - name='access_detail'), - url(INSTANCES % 'create_database', views.CreateDatabaseView.as_view(), - name='create_database'), - url(INSTANCES % 'promote_to_replica_source', - views.PromoteToReplicaSourceView.as_view(), - name='promote_to_replica_source'), - url(INSTANCES % 'attach_config', views.AttachConfigurationView.as_view(), - name='attach_config'), - url(INSTANCES % 'manage_root', views.ManageRootView.as_view(), - name='manage_root'), - url(BASEINSTANCES % 'logs/', include((logs_urls, 'logs'))), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^launch$', views.LaunchInstanceView.as_view(), name='launch'), + re_path(INSTANCES % '', views.DetailView.as_view(), name='detail'), + re_path(INSTANCES % 'edit_instance', views.UpdateInstanceView.as_view(), + name='edit_instance'), + re_path(INSTANCES % 'resize_volume', views.ResizeVolumeView.as_view(), + name='resize_volume'), + re_path(INSTANCES % 'resize_instance', views.ResizeInstanceView.as_view(), + name='resize_instance'), + re_path(INSTANCES % 'create_user', views.CreateUserView.as_view(), + name='create_user'), + re_path(USERS % 'edit_user', views.EditUserView.as_view(), + name='edit_user'), + re_path(USERS % 'access_detail', views.AccessDetailView.as_view(), + name='access_detail'), + re_path(INSTANCES % 'create_database', views.CreateDatabaseView.as_view(), + name='create_database'), + re_path(INSTANCES % 'promote_to_replica_source', + views.PromoteToReplicaSourceView.as_view(), + name='promote_to_replica_source'), + re_path(INSTANCES % 'attach_config', + views.AttachConfigurationView.as_view(), + name='attach_config'), + re_path(INSTANCES % 'manage_root', views.ManageRootView.as_view(), + name='manage_root'), + re_path(BASEINSTANCES % 'logs/', include((logs_urls, 'logs'))), ] diff --git a/trove_dashboard/content/ng_database_backups/urls.py b/trove_dashboard/content/ng_database_backups/urls.py index f7d9180..c8bbcff 100644 --- a/trove_dashboard/content/ng_database_backups/urls.py +++ b/trove_dashboard/content/ng_database_backups/urls.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import urls +from django.urls import re_path from trove_dashboard.content.ng_database_backups import views urlpatterns = [ - urls.url(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^$', views.IndexView.as_view(), name='index'), ] diff --git a/trove_dashboard/test/urls.py b/trove_dashboard/test/urls.py index cf28475..c588ccb 100644 --- a/trove_dashboard/test/urls.py +++ b/trove_dashboard/test/urls.py @@ -11,9 +11,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import urls +from django.urls import include +from django.urls import re_path import openstack_dashboard.urls urlpatterns = [ - urls.url(r'', urls.include(openstack_dashboard.urls)) + re_path(r'', include(openstack_dashboard.urls)) ]