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
This commit is contained in:
Thomas Goirand 2022-07-28 16:36:03 +02:00
parent c06ec18d95
commit 56a6e73dee
8 changed files with 76 additions and 74 deletions

View File

@ -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'),
]

View File

@ -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<backup_id>[^/]+)/$', views.DetailView.as_view(),
re_path(r'^$', views.IndexView.as_view(), name='index'),
re_path(r'^create$', views.BackupView.as_view(), name='create'),
re_path(r'^(?P<backup_id>[^/]+)/$', views.DetailView.as_view(),
name='detail'),
]

View File

@ -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<cluster_id>[^/]+)/%s$'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^launch$', views.LaunchClusterView.as_view(), name='launch'),
url(r'^(?P<cluster_id>[^/]+)/$', views.DetailView.as_view(),
re_path(r'^$', views.IndexView.as_view(), name='index'),
re_path(r'^launch$', views.LaunchClusterView.as_view(), name='launch'),
re_path(r'^(?P<cluster_id>[^/]+)/$', views.DetailView.as_view(),
name='detail'),
url(CLUSTERS % 'cluster_grow_details',
re_path(CLUSTERS % 'cluster_grow_details',
views.ClusterGrowView.as_view(),
name='cluster_grow_details'),
url(CLUSTERS % 'add_instance',
re_path(CLUSTERS % 'add_instance',
views.ClusterAddInstancesView.as_view(),
name='add_instance'),
url(CLUSTERS % 'cluster_shrink_details',
re_path(CLUSTERS % 'cluster_shrink_details',
views.ClusterShrinkView.as_view(),
name='cluster_shrink_details'),
url(CLUSTERS % 'reset_password',
re_path(CLUSTERS % 'reset_password',
views.ResetPasswordView.as_view(),
name='reset_password'),
]

View File

@ -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<configuration_id>[^/]+)/%s$'
urlpatterns = [
url(r'^$',
re_path(r'^$',
views.IndexView.as_view(),
name='index'),
url(r'^create$',
re_path(r'^create$',
views.CreateConfigurationView.as_view(),
name='create'),
url(CONFIGS % '',
re_path(CONFIGS % '',
views.DetailView.as_view(),
name='detail'),
url(CONFIGS % 'add',
re_path(CONFIGS % 'add',
views.AddParameterView.as_view(),
name='add')
]

View File

@ -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<filename>[^/]+)/%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',
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'),
]

View File

@ -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<instance_id>[^/]+)/(?P<user_name>[^/]+)/' \
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(),
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'),
url(INSTANCES % 'resize_volume', views.ResizeVolumeView.as_view(),
re_path(INSTANCES % 'resize_volume', views.ResizeVolumeView.as_view(),
name='resize_volume'),
url(INSTANCES % 'resize_instance', views.ResizeInstanceView.as_view(),
re_path(INSTANCES % 'resize_instance', views.ResizeInstanceView.as_view(),
name='resize_instance'),
url(INSTANCES % 'create_user', views.CreateUserView.as_view(),
re_path(INSTANCES % 'create_user', views.CreateUserView.as_view(),
name='create_user'),
url(USERS % 'edit_user', views.EditUserView.as_view(),
re_path(USERS % 'edit_user', views.EditUserView.as_view(),
name='edit_user'),
url(USERS % 'access_detail', views.AccessDetailView.as_view(),
re_path(USERS % 'access_detail', views.AccessDetailView.as_view(),
name='access_detail'),
url(INSTANCES % 'create_database', views.CreateDatabaseView.as_view(),
re_path(INSTANCES % 'create_database', views.CreateDatabaseView.as_view(),
name='create_database'),
url(INSTANCES % 'promote_to_replica_source',
re_path(INSTANCES % 'promote_to_replica_source',
views.PromoteToReplicaSourceView.as_view(),
name='promote_to_replica_source'),
url(INSTANCES % 'attach_config', views.AttachConfigurationView.as_view(),
re_path(INSTANCES % 'attach_config',
views.AttachConfigurationView.as_view(),
name='attach_config'),
url(INSTANCES % 'manage_root', views.ManageRootView.as_view(),
re_path(INSTANCES % 'manage_root', views.ManageRootView.as_view(),
name='manage_root'),
url(BASEINSTANCES % 'logs/', include((logs_urls, 'logs'))),
re_path(BASEINSTANCES % 'logs/', include((logs_urls, 'logs'))),
]

View File

@ -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'),
]

View File

@ -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))
]