From 6289954907a54724befcbbafea9b7aeeb6d9738a Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Fri, 29 Apr 2022 17:17:42 +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: I0f7a59d28f8611ccaf66143ea6cdf0a89cedf80f --- monitoring/alarmdefs/urls.py | 22 +++++++++++----------- monitoring/alarms/urls.py | 28 ++++++++++++++-------------- monitoring/notifications/urls.py | 16 ++++++++-------- monitoring/overview/urls.py | 18 +++++++++--------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/monitoring/alarmdefs/urls.py b/monitoring/alarmdefs/urls.py index af195522..3416b24a 100644 --- a/monitoring/alarmdefs/urls.py +++ b/monitoring/alarmdefs/urls.py @@ -11,19 +11,19 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # 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 from monitoring.alarmdefs import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^alarm/create$', - views.AlarmCreateView.as_view(), - name='alarm_create'), - url(r'^(?P[^/]+)/alarm_detail/$', - views.AlarmDetailView.as_view(), - name='alarm_detail'), - url(r'^alarm/(?P[^/]+)/alarm_edit/$', - views.AlarmEditView.as_view(), - name='alarm_edit') + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^alarm/create$', + views.AlarmCreateView.as_view(), + name='alarm_create'), + re_path(r'^(?P[^/]+)/alarm_detail/$', + views.AlarmDetailView.as_view(), + name='alarm_detail'), + re_path(r'^alarm/(?P[^/]+)/alarm_edit/$', + views.AlarmEditView.as_view(), + name='alarm_edit') ] diff --git a/monitoring/alarms/urls.py b/monitoring/alarms/urls.py index 5a0560c8..14daf944 100644 --- a/monitoring/alarms/urls.py +++ b/monitoring/alarms/urls.py @@ -11,22 +11,22 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # 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 from monitoring.alarms import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^alarm/filter/$', - views.AlarmFilterView.as_view(), - name='alarm_filter'), - url(r'^alarm/(?P[^/]+)/$', - views.AlarmServiceView.as_view(), - name='alarm'), - url(r'^alarm/$', - views.AlarmServiceView.as_view(), - name='alarm_all'), - url(r'^history/(?P[^/]+)/(?P[^/]+)$', - views.AlarmHistoryView.as_view(), - name='history') + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^alarm/filter/$', + views.AlarmFilterView.as_view(), + name='alarm_filter'), + re_path(r'^alarm/(?P[^/]+)/$', + views.AlarmServiceView.as_view(), + name='alarm'), + re_path(r'^alarm/$', + views.AlarmServiceView.as_view(), + name='alarm_all'), + re_path(r'^history/(?P[^/]+)/(?P[^/]+)$', + views.AlarmHistoryView.as_view(), + name='history') ] diff --git a/monitoring/notifications/urls.py b/monitoring/notifications/urls.py index eb3ad663..343edcb1 100644 --- a/monitoring/notifications/urls.py +++ b/monitoring/notifications/urls.py @@ -11,16 +11,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # 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 from monitoring.notifications import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^notification_create$', - views.NotificationCreateView.as_view(), - name='notification_create'), - url(r'^notification_edit/(?P[^/]+)$', - views.NotificationEditView.as_view(), - name='notification_edit') + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^notification_create$', + views.NotificationCreateView.as_view(), + name='notification_create'), + re_path(r'^notification_edit/(?P[^/]+)$', + views.NotificationEditView.as_view(), + name='notification_edit') ] diff --git a/monitoring/overview/urls.py b/monitoring/overview/urls.py index 21d4b78f..21141712 100644 --- a/monitoring/overview/urls.py +++ b/monitoring/overview/urls.py @@ -11,19 +11,19 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 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 monitoring.config import local_settings as settings from monitoring.overview import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^status', views.StatusView.as_view(), name='status'), - url(r'^proxy\/(?P.*)$', views.MonascaProxyView.as_view()), - url(r'^proxy', views.MonascaProxyView.as_view(), name='proxy'), - url(r'^logs_proxy(?P.*)$', - views.KibanaProxyView.as_view( - base_url=settings.KIBANA_HOST), name='kibana_proxy' - ) + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^status', views.StatusView.as_view(), name='status'), + re_path(r'^proxy\/(?P.*)$', views.MonascaProxyView.as_view()), + re_path(r'^proxy', views.MonascaProxyView.as_view(), name='proxy'), + re_path(r'^logs_proxy(?P.*)$', + views.KibanaProxyView.as_view(base_url=settings.KIBANA_HOST), + name='kibana_proxy' + ) ]