From d9fd377e29d3d59501e28c06ff76c9afb43d76de Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Mon, 2 Apr 2018 11:13:35 +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 depreacted in Django 1.10: https://docs.djangoproject.com/en/2.0/releases/1.10/#id3 Add py35dj20 job to test Django 2.0 integration. Also drops py27dj110 from tox.ini as horizon droped Django 1.10 support in Rocky. Change-Id: Ieb4364d9c46f126d4fa797b42f7602fb73f33a0f --- .zuul.yaml | 6 ++++++ neutron_vpnaas_dashboard/dashboards/project/vpn/forms.py | 2 +- neutron_vpnaas_dashboard/dashboards/project/vpn/tables.py | 2 +- neutron_vpnaas_dashboard/dashboards/project/vpn/tests.py | 2 +- neutron_vpnaas_dashboard/dashboards/project/vpn/views.py | 4 ++-- releasenotes/notes/django2-support-ef2f2bd52a8bb63f.yaml | 6 ++++++ tox.ini | 6 +++--- 7 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/django2-support-ef2f2bd52a8bb63f.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 737eaf3..40b372a 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,8 +4,14 @@ - openstack-tox-lower-constraints: required-projects: - openstack/horizon + - horizon-openstack-tox-py35dj20: + required-projects: + - openstack/horizon gate: jobs: - openstack-tox-lower-constraints: required-projects: - openstack/horizon + - horizon-openstack-tox-py35dj20: + required-projects: + - openstack/horizon diff --git a/neutron_vpnaas_dashboard/dashboards/project/vpn/forms.py b/neutron_vpnaas_dashboard/dashboards/project/vpn/forms.py index 5d8725b..b737807 100644 --- a/neutron_vpnaas_dashboard/dashboards/project/vpn/forms.py +++ b/neutron_vpnaas_dashboard/dashboards/project/vpn/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 diff --git a/neutron_vpnaas_dashboard/dashboards/project/vpn/tables.py b/neutron_vpnaas_dashboard/dashboards/project/vpn/tables.py index ca492d2..a39d766 100644 --- a/neutron_vpnaas_dashboard/dashboards/project/vpn/tables.py +++ b/neutron_vpnaas_dashboard/dashboards/project/vpn/tables.py @@ -13,8 +13,8 @@ # under the License. -from django.core.urlresolvers import reverse from django import template +from django.urls import reverse from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy diff --git a/neutron_vpnaas_dashboard/dashboards/project/vpn/tests.py b/neutron_vpnaas_dashboard/dashboards/project/vpn/tests.py index 6984d14..5e98a53 100644 --- a/neutron_vpnaas_dashboard/dashboards/project/vpn/tests.py +++ b/neutron_vpnaas_dashboard/dashboards/project/vpn/tests.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.workflows import views diff --git a/neutron_vpnaas_dashboard/dashboards/project/vpn/views.py b/neutron_vpnaas_dashboard/dashboards/project/vpn/views.py index f6e7799..00b2aa2 100644 --- a/neutron_vpnaas_dashboard/dashboards/project/vpn/views.py +++ b/neutron_vpnaas_dashboard/dashboards/project/vpn/views.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.core.urlresolvers import reverse_lazy +from django.urls import reverse +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/releasenotes/notes/django2-support-ef2f2bd52a8bb63f.yaml b/releasenotes/notes/django2-support-ef2f2bd52a8bb63f.yaml new file mode 100644 index 0000000..7ada6be --- /dev/null +++ b/releasenotes/notes/django2-support-ef2f2bd52a8bb63f.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + Supported django versions are chagned aligning with the supported versions + by horizon. Django 1.11 and 2.0 are supported now. Django 1.8 to 1.10 are + no longer supported. diff --git a/tox.ini b/tox.ini index 27fc6ef..2a0d97e 100644 --- a/tox.ini +++ b/tox.ini @@ -35,10 +35,10 @@ commands = coverage xml --omit '.tox/cover/*' -o 'cover/coverage.xml' coverage html --omit '.tox/cover/*' -d 'cover/htmlcov' -[testenv:py27dj110] -basepython = python2.7 +[testenv:py35dj20] +basepython = python3.5 commands = - pip install django>=1.10,<1.11 + pip install django>=2.0,<2.1 {[unit_tests]commands} [testenv:docs]