Replace patterns syntax by url

The old syntax using patterns is deprecated in Django 1.8, and is
removed in Django 1.10. The current version Django<1.11, this
patch fix the syntax.

Change-Id: I26564c97538c23378c0494739257b31dd8796f5a
Closes-Bug: #1709742
This commit is contained in:
yapeng 2017-08-10 02:57:19 +00:00
parent e779891638
commit d6ae33196b
7 changed files with 14 additions and 39 deletions

View File

@ -12,15 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from disaster_recovery.actions import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/(?P<action_id>[^/]+)?$',
@ -30,4 +26,4 @@ urlpatterns = patterns(
url(r'^action/(?P<action_id>[^/]+)?$',
views.ActionView.as_view(),
name='action'),
)
]

View File

@ -16,15 +16,12 @@
URL patterns for the OpenStack Dashboard.
"""
from django.conf.urls import patterns
from django.conf.urls import url
import rest_api
urlpatterns = patterns(
'',
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<job_id>[^/]+)?$',
rest_api.Actions.as_view(), name="api_actions_in_job"),
)
]

View File

@ -13,17 +13,15 @@
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from disaster_recovery.backups import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<backup_id>[^/]*)$', views.DetailView.as_view(), name='detail'),
url(r'^restore/(?P<backup_id>.*)$',
views.RestoreView.as_view(),
name='restore'),
)
]

View File

@ -12,18 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from disaster_recovery.clients import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<client_id>[^/]+)?$',
views.ClientView.as_view(),
name='client'),
)
]

View File

@ -12,15 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from disaster_recovery.jobs import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<job_id>[^/]+)?$',
views.JobsView.as_view(),
name='index'),
@ -40,4 +35,4 @@ urlpatterns = patterns(
url(r'^edit_actions/(?P<job_id>[^/]+)?$',
views.ActionsInJobView.as_view(),
name='edit_action'),
)
]

View File

@ -12,15 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from disaster_recovery.sessions import views
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<session_id>[^/]+)?$',
views.SessionsView.as_view(),
name='index'),
@ -37,4 +33,4 @@ urlpatterns = patterns(
views.CreateSessionWorkflow.as_view(),
name='edit'),
)
]

View File

@ -13,13 +13,10 @@
# limitations under the License.
from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls import url
import disaster_recovery.api.rest.urls as rest_urls
urlpatterns = patterns(
'',
urlpatterns = [
url(r'', include(rest_urls)),
)
]