From b3ab8770662e441d9ef0a147fde84d415cf5a244 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Thu, 10 May 2018 23:19:09 +0900 Subject: [PATCH] Django 2.0 support Replace django.core.urlresolves with django.urls (In Django 2.0) The django.core.urlresolvers module is removed in favor of its new location, django.urls. It was deprecated in Django 1.10: https://docs.djangoproject.com/en/2.0/releases/1.10/#id3 Add py35dj20 job to test Django 2.0 integration. Change-Id: I89dea8aaeb2a7d42a9ce99e7cb236c491b34c138 --- .zuul.yaml | 6 ++++++ congress_dashboard/datasources/forms.py | 2 +- congress_dashboard/datasources/tables.py | 2 +- congress_dashboard/datasources/views.py | 4 ++-- congress_dashboard/library/tables.py | 2 +- congress_dashboard/monitoring/tables.py | 2 +- congress_dashboard/policies/forms.py | 2 +- congress_dashboard/policies/rules/forms.py | 2 +- congress_dashboard/policies/rules/tables.py | 2 +- congress_dashboard/policies/rules/views.py | 2 +- congress_dashboard/policies/rules/workflows.py | 2 +- congress_dashboard/policies/tables.py | 2 +- congress_dashboard/policies/views.py | 4 ++-- tox.ini | 6 ++++++ 14 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 67a39c4..58d8a82 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,6 +2,12 @@ check: jobs: - openstack-tox-lower-constraints + - horizon-openstack-tox-py35dj20: + required-projects: + openstack/horizon gate: jobs: - openstack-tox-lower-constraints + - horizon-openstack-tox-py35dj20: + required-projects: + openstack/horizon diff --git a/congress_dashboard/datasources/forms.py b/congress_dashboard/datasources/forms.py index 32454b9..a0626bb 100644 --- a/congress_dashboard/datasources/forms.py +++ b/congress_dashboard/datasources/forms.py @@ -14,7 +14,7 @@ import logging -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms diff --git a/congress_dashboard/datasources/tables.py b/congress_dashboard/datasources/tables.py index 69d827e..84a3678 100644 --- a/congress_dashboard/datasources/tables.py +++ b/congress_dashboard/datasources/tables.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django.template.defaultfilters import unordered_list +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import tables diff --git a/congress_dashboard/datasources/views.py b/congress_dashboard/datasources/views.py index 3c61c3b..48192f5 100644 --- a/congress_dashboard/datasources/views.py +++ b/congress_dashboard/datasources/views.py @@ -15,9 +15,9 @@ import copy import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy from django.template.defaultfilters import slugify +from django.urls import reverse +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms diff --git a/congress_dashboard/library/tables.py b/congress_dashboard/library/tables.py index b205a45..e8488a3 100644 --- a/congress_dashboard/library/tables.py +++ b/congress_dashboard/library/tables.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django.template.defaultfilters import linebreaksbr +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import tables diff --git a/congress_dashboard/monitoring/tables.py b/congress_dashboard/monitoring/tables.py index f24db6e..7bd41f7 100644 --- a/congress_dashboard/monitoring/tables.py +++ b/congress_dashboard/monitoring/tables.py @@ -14,7 +14,7 @@ import logging -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import tables diff --git a/congress_dashboard/policies/forms.py b/congress_dashboard/policies/forms.py index a3e8a73..e96ad72 100644 --- a/congress_dashboard/policies/forms.py +++ b/congress_dashboard/policies/forms.py @@ -14,7 +14,7 @@ import logging -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms diff --git a/congress_dashboard/policies/rules/forms.py b/congress_dashboard/policies/rules/forms.py index 1136ada..efdbdd2 100644 --- a/congress_dashboard/policies/rules/forms.py +++ b/congress_dashboard/policies/rules/forms.py @@ -14,7 +14,7 @@ import logging -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms diff --git a/congress_dashboard/policies/rules/tables.py b/congress_dashboard/policies/rules/tables.py index 1e77eb3..51dea5f 100644 --- a/congress_dashboard/policies/rules/tables.py +++ b/congress_dashboard/policies/rules/tables.py @@ -14,8 +14,8 @@ import logging -from django.core.urlresolvers import reverse from django.template.defaultfilters import linebreaksbr +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import exceptions diff --git a/congress_dashboard/policies/rules/views.py b/congress_dashboard/policies/rules/views.py index 04ee011..ec485a9 100644 --- a/congress_dashboard/policies/rules/views.py +++ b/congress_dashboard/policies/rules/views.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.urls import reverse from horizon import forms from horizon import workflows diff --git a/congress_dashboard/policies/rules/workflows.py b/congress_dashboard/policies/rules/workflows.py index bcc4f4e..0bc6f39 100644 --- a/congress_dashboard/policies/rules/workflows.py +++ b/congress_dashboard/policies/rules/workflows.py @@ -15,8 +15,8 @@ import logging import re -from django.core.urlresolvers import reverse from django import template +from django.urls import reverse from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ from horizon import forms diff --git a/congress_dashboard/policies/tables.py b/congress_dashboard/policies/tables.py index 3df38ba..e8c371e 100644 --- a/congress_dashboard/policies/tables.py +++ b/congress_dashboard/policies/tables.py @@ -14,7 +14,7 @@ import logging -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import exceptions diff --git a/congress_dashboard/policies/views.py b/congress_dashboard/policies/views.py index ce385fd..dd3046a 100644 --- a/congress_dashboard/policies/views.py +++ b/congress_dashboard/policies/views.py @@ -15,9 +15,9 @@ import json import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy from django.template.defaultfilters import dictsort +from django.urls import reverse +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms diff --git a/tox.ini b/tox.ini index 9575f04..7c3dcea 100644 --- a/tox.ini +++ b/tox.ini @@ -68,3 +68,9 @@ deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + +[testenv:py35dj20] +basepython = python3.5 +commands = + pip install django>=2.0,<2.1 + {[testenv]commands}