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 The arguments of include() has been changed in Django 1.9 and the older style was dropped in Django 2.0. https://docs.djangoproject.com/en/2.0/releases/1.9/#passing-a-3-tuple-or-an-app-name-to-include Add py35dj20 job to test Django 2.0 integration. Also drops older Django unit tests from tox.ini as horizon dropped Django <=1.10 support in Rocky. Depends-On: https://review.openstack.org/#/c/571061/ Change-Id: I122f8ad81807386517149f37aa8d63c76daac533
This commit is contained in:
parent
c72296e5e1
commit
ddaf10204a
@ -0,0 +1,7 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Django 2.0 is now supported and Django versions older than 1.11 are no
|
||||
longer supported aligning with Django versions supported by horizon.
|
||||
Note that Django 1.11 is still supported and this is the only version
|
||||
when you use python 2.7.
|
19
tox.ini
19
tox.ini
@ -1,6 +1,6 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = py27,pep8,py27dj18
|
||||
envlist = py27,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
@ -22,20 +22,9 @@ commands = flake8
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
# Django-1.8 is LTS
|
||||
[testenv:py27dj18]
|
||||
basepython = python2.7
|
||||
commands = pip install django>=1.8,<1.9
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:py27dj19]
|
||||
basepython = python2.7
|
||||
commands = pip install django>=1.9,<1.10
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:py27dj110]
|
||||
basepython = python2.7
|
||||
commands = pip install django>=1.10,<1.11
|
||||
[testenv:py35dj20]
|
||||
basepython = python3.5
|
||||
commands = pip install django>=2.0,<2.1
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:py27integration]
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.template import defaultfilters as d_filters
|
||||
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
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from mox3.mox import IsA # noqa
|
||||
import six
|
||||
|
@ -15,7 +15,7 @@
|
||||
"""
|
||||
Views for displaying database backups.
|
||||
"""
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
|
@ -16,7 +16,7 @@
|
||||
import collections
|
||||
import uuid
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.decorators.debug import sensitive_variables # noqa
|
||||
|
||||
|
@ -14,9 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django import shortcuts
|
||||
from django.template.defaultfilters import title # noqa
|
||||
from django import urls
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -111,7 +111,7 @@ class ResetPassword(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
cluster_id = self.table.get_object_id(datum)
|
||||
return urlresolvers.reverse(self.url, args=[cluster_id])
|
||||
return urls.reverse(self.url, args=[cluster_id])
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
@ -300,7 +300,7 @@ class ClusterGrowAddInstance(tables.LinkAction):
|
||||
classes = ("ajax-modal",)
|
||||
|
||||
def get_link_url(self):
|
||||
return urlresolvers.reverse(
|
||||
return urls.reverse(
|
||||
self.url, args=[self.table.kwargs['cluster_id']])
|
||||
|
||||
|
||||
@ -413,7 +413,7 @@ class ClusterGrowAction(tables.Action):
|
||||
finally:
|
||||
cluster_manager.delete(cluster_id)
|
||||
|
||||
return shortcuts.redirect(urlresolvers.reverse(
|
||||
return shortcuts.redirect(urls.reverse(
|
||||
"horizon:project:database_clusters:index"))
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from django.urls import reverse
|
||||
|
||||
from mox3.mox import IsA # noqa
|
||||
|
||||
|
@ -19,8 +19,8 @@ Views for managing database clusters.
|
||||
"""
|
||||
from collections import OrderedDict
|
||||
|
||||
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 _
|
||||
|
||||
import six
|
||||
|
@ -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 django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import six
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django import shortcuts
|
||||
from django import urls
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -91,7 +91,7 @@ class AddParameter(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum=None):
|
||||
configuration_id = self.table.kwargs['configuration_id']
|
||||
return urlresolvers.reverse(self.url, args=[configuration_id])
|
||||
return urls.reverse(self.url, args=[configuration_id])
|
||||
|
||||
|
||||
class ApplyChanges(tables.Action):
|
||||
|
@ -17,8 +17,8 @@ import six
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from django.urls import reverse
|
||||
from mox3.mox import IsA # noqa
|
||||
|
||||
from trove_dashboard import api
|
||||
|
@ -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
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.forms import ValidationError # noqa
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import six
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django import urls
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -129,9 +129,7 @@ class ViewLog(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
instance_id = self.table.kwargs['instance_id']
|
||||
return urlresolvers.reverse(self.url,
|
||||
args=(instance_id,
|
||||
datum.name))
|
||||
return urls.reverse(self.url, args=(instance_id, datum.name))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
if datum:
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from django.urls import reverse
|
||||
|
||||
from mox3 import mox
|
||||
from mox3.mox import IsA # noqa
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from django.core import urlresolvers
|
||||
from django.template import defaultfilters as d_filters
|
||||
from django import urls
|
||||
|
||||
from django.utils.translation import pgettext_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@ -132,7 +132,7 @@ class PromoteToReplicaSource(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
instance_id = self.table.get_object_id(datum)
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
class EjectReplicaSource(tables.BatchAction):
|
||||
@ -270,9 +270,9 @@ class ManageAccess(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
user = datum
|
||||
return urlresolvers.reverse(self.url, args=[user.instance.id,
|
||||
user.name,
|
||||
user.host])
|
||||
return urls.reverse(self.url, args=[user.instance.id,
|
||||
user.name,
|
||||
user.host])
|
||||
|
||||
|
||||
class CreateUser(tables.LinkAction):
|
||||
@ -289,7 +289,7 @@ class CreateUser(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum=None):
|
||||
instance_id = self.table.kwargs['instance_id']
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
class EditUser(tables.LinkAction):
|
||||
@ -306,9 +306,9 @@ class EditUser(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
user = datum
|
||||
return urlresolvers.reverse(self.url, args=[user.instance.id,
|
||||
user.name,
|
||||
user.host])
|
||||
return urls.reverse(self.url, args=[user.instance.id,
|
||||
user.name,
|
||||
user.host])
|
||||
|
||||
|
||||
def has_user_add_perm(request):
|
||||
@ -355,7 +355,7 @@ class CreateDatabase(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum=None):
|
||||
instance_id = self.table.kwargs['instance_id']
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
def has_database_add_perm(request):
|
||||
@ -411,7 +411,7 @@ class CreateBackup(tables.LinkAction):
|
||||
request.user.has_perm('openstack.services.object-store'))
|
||||
|
||||
def get_link_url(self, datam):
|
||||
url = urlresolvers.reverse(self.url)
|
||||
url = urls.reverse(self.url)
|
||||
return url + "?instance=%s" % datam.id
|
||||
|
||||
|
||||
@ -426,7 +426,7 @@ class ResizeVolume(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
instance_id = self.table.get_object_id(datum)
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
class ResizeInstance(tables.LinkAction):
|
||||
@ -441,7 +441,7 @@ class ResizeInstance(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum):
|
||||
instance_id = self.table.get_object_id(datum)
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
class AttachConfiguration(tables.LinkAction):
|
||||
@ -525,7 +525,7 @@ class ManageRoot(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum=None):
|
||||
instance_id = self.table.get_object_id(datum)
|
||||
return urlresolvers.reverse(self.url, args=[instance_id])
|
||||
return urls.reverse(self.url, args=[instance_id])
|
||||
|
||||
|
||||
class ManageRootTable(tables.DataTable):
|
||||
|
@ -16,8 +16,8 @@
|
||||
import logging
|
||||
|
||||
import django
|
||||
from django.core.urlresolvers import reverse
|
||||
from django import http
|
||||
from django.urls import reverse
|
||||
import unittest
|
||||
|
||||
from mox3.mox import IsA # noqa
|
||||
|
@ -47,5 +47,5 @@ urlpatterns = [
|
||||
name='attach_config'),
|
||||
url(INSTANCES % 'manage_root', views.ManageRootView.as_view(),
|
||||
name='manage_root'),
|
||||
url(BASEINSTANCES % 'logs/', include(logs_urls, namespace='logs')),
|
||||
url(BASEINSTANCES % 'logs/', include((logs_urls, 'logs'))),
|
||||
]
|
||||
|
@ -17,8 +17,8 @@ Views for managing database instances.
|
||||
"""
|
||||
from collections import OrderedDict
|
||||
|
||||
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 _
|
||||
|
||||
import six
|
||||
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
|
Loading…
Reference in New Issue
Block a user