Support Django 2.0
Change-Id: I559cfece3e696a83eee3cb9aeec22b6b65d34bfc story: 2002191 task: 20064
This commit is contained in:
parent
5bf91e98d7
commit
999bfa2a05
@ -91,7 +91,7 @@ class MatchByWidget(forms.Widget):
|
||||
|
||||
class NotificationField(forms.MultiValueField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NotificationField, self).__init__(*args, **kwargs)
|
||||
super(NotificationField, self).__init__(fields=(), *args, **kwargs)
|
||||
|
||||
def _get_choices(self):
|
||||
return self._choices
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -31,8 +31,7 @@ class CreateAlarm(tables.LinkAction):
|
||||
ajax = True
|
||||
|
||||
def get_link_url(self):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_create',
|
||||
args=())
|
||||
return reverse(constants.URL_PREFIX + 'alarm_create', args=())
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
@ -44,8 +43,7 @@ class EditAlarm(tables.LinkAction):
|
||||
classes = ("ajax-modal", "btn-create")
|
||||
|
||||
def get_link_url(self, datum):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_edit',
|
||||
args=(datum['id'], ))
|
||||
return reverse(constants.URL_PREFIX + 'alarm_edit', args=(datum['id'], ))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from monitoring.alarmdefs import constants
|
||||
@ -22,14 +22,10 @@ from monitoring.alarmdefs import workflows
|
||||
from monitoring.test import helpers
|
||||
|
||||
|
||||
INDEX_URL = urlresolvers.reverse(
|
||||
constants.URL_PREFIX + 'index')
|
||||
CREATE_URL = urlresolvers.reverse(
|
||||
constants.URL_PREFIX + 'alarm_create', args=())
|
||||
DETAIL_URL = urlresolvers.reverse(
|
||||
constants.URL_PREFIX + 'alarm_detail', args=('12345',))
|
||||
EDIT_URL = urlresolvers.reverse(
|
||||
constants.URL_PREFIX + 'alarm_edit', args=('12345',))
|
||||
INDEX_URL = reverse(constants.URL_PREFIX + 'index')
|
||||
CREATE_URL = reverse(constants.URL_PREFIX + 'alarm_create', args=())
|
||||
DETAIL_URL = reverse(constants.URL_PREFIX + 'alarm_detail', args=('12345',))
|
||||
EDIT_URL = reverse(constants.URL_PREFIX + 'alarm_edit', args=('12345',))
|
||||
|
||||
|
||||
class AlarmDefinitionsTest(helpers.TestCase):
|
||||
|
@ -17,8 +17,8 @@ import logging
|
||||
from django.contrib import messages
|
||||
from django.core.paginator import EmptyPage
|
||||
from django.core.paginator import Paginator
|
||||
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 as _ # noqa
|
||||
from django.views.generic import TemplateView
|
||||
import six
|
||||
|
@ -89,7 +89,7 @@ class SimpleExpressionWidget(django_forms.MultiWidget):
|
||||
|
||||
class NotificationField(forms.MultiValueField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NotificationField, self).__init__(*args, **kwargs)
|
||||
super(NotificationField, self).__init__(fields=(), *args, **kwargs)
|
||||
|
||||
def _get_choices(self):
|
||||
return self._choices
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
import json
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django import template
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -108,9 +108,8 @@ class ShowAlarmHistory(tables.LinkAction):
|
||||
classes = ('btn-edit',)
|
||||
|
||||
def get_link_url(self, datum):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'history',
|
||||
args=(datum['alarm_definition']['id'],
|
||||
datum['id'], ))
|
||||
return reverse(constants.URL_PREFIX + 'history',
|
||||
args=(datum['alarm_definition']['id'], datum['id'], ))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
@ -125,8 +124,8 @@ class CreateAlarm(tables.LinkAction):
|
||||
ajax = True
|
||||
|
||||
def get_link_url(self):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_create',
|
||||
args=(self.table.kwargs['service'],))
|
||||
return reverse(constants.URL_PREFIX + 'alarm_create',
|
||||
args=(self.table.kwargs['service'],))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
@ -138,9 +137,8 @@ class EditAlarm(tables.LinkAction):
|
||||
classes = ("ajax-modal", "btn-create")
|
||||
|
||||
def get_link_url(self, datum):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_edit',
|
||||
args=(self.table.kwargs['service'],
|
||||
datum['id'], ))
|
||||
return reverse(constants.URL_PREFIX + 'alarm_edit',
|
||||
args=(self.table.kwargs['service'], datum['id'], ))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
@ -191,7 +189,7 @@ class ShowAlarmDefinition(tables.LinkAction):
|
||||
def get_link_url(self, datum=None):
|
||||
url = 'horizon:monitoring:alarmdefs:alarm_detail'
|
||||
args = (datum['alarm_definition']['id'],)
|
||||
return urlresolvers.reverse_lazy(url, args=args)
|
||||
return reverse_lazy(url, args=args)
|
||||
|
||||
|
||||
class DeleteAlarm(tables.DeleteAction):
|
||||
@ -230,8 +228,7 @@ class AlarmsFilterAction(tables.LinkAction):
|
||||
ajax = True
|
||||
|
||||
def get_link_url(self):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_filter',
|
||||
args=())
|
||||
return reverse(constants.URL_PREFIX + 'alarm_filter', args=())
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from monitoring.alarms import constants
|
||||
@ -18,11 +18,11 @@ from monitoring.alarms import tables
|
||||
from monitoring.test import helpers
|
||||
|
||||
|
||||
INDEX_URL = urlresolvers.reverse(
|
||||
INDEX_URL = reverse(
|
||||
constants.URL_PREFIX + 'index')
|
||||
ALARMS_URL_BY_DIMENSION = urlresolvers.reverse(
|
||||
ALARMS_URL_BY_DIMENSION = reverse(
|
||||
constants.URL_PREFIX + 'alarm', args=('nova',))
|
||||
ALARMS_URL = urlresolvers.reverse(
|
||||
ALARMS_URL = reverse(
|
||||
constants.URL_PREFIX + 'alarm', args=('all',))
|
||||
|
||||
|
||||
|
@ -20,9 +20,9 @@ from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.core.paginator import EmptyPage
|
||||
from django.core.paginator import Paginator
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.dateparse import parse_datetime
|
||||
from django.utils.translation import ugettext as _ # noqa
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
@ -66,7 +66,7 @@ class CreateNotification(tables.LinkAction):
|
||||
|
||||
def get_link_url(self):
|
||||
url = constants.URL_PREFIX + 'notification_create'
|
||||
return urlresolvers.reverse(url)
|
||||
return reverse(url)
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
@ -78,8 +78,8 @@ class EditNotification(tables.LinkAction):
|
||||
classes = ("ajax-modal", "btn-create")
|
||||
|
||||
def get_link_url(self, datum):
|
||||
return urlresolvers.reverse(constants.URL_PREFIX + 'notification_edit',
|
||||
args=(datum['id'], ))
|
||||
return reverse(constants.URL_PREFIX + 'notification_edit',
|
||||
args=(datum['id'], ))
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
@ -10,18 +10,18 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from monitoring.notifications import constants
|
||||
from monitoring.test import helpers
|
||||
|
||||
|
||||
INDEX_URL = urlresolvers.reverse(
|
||||
INDEX_URL = reverse(
|
||||
constants.URL_PREFIX + 'index')
|
||||
CREATE_URL = urlresolvers.reverse(
|
||||
CREATE_URL = reverse(
|
||||
constants.URL_PREFIX + 'notification_create')
|
||||
EDIT_URL = urlresolvers.reverse(
|
||||
EDIT_URL = reverse(
|
||||
constants.URL_PREFIX + 'notification_edit', args=('12345',))
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
from django.contrib import messages
|
||||
from django.core.paginator import EmptyPage
|
||||
from django.core.paginator import Paginator
|
||||
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 as _ # noqa
|
||||
|
||||
from horizon import exceptions
|
||||
|
@ -12,15 +12,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.test import RequestFactory
|
||||
from django.urls import reverse
|
||||
|
||||
from monitoring.overview import constants
|
||||
from monitoring.overview import views
|
||||
from monitoring.test import helpers
|
||||
|
||||
|
||||
INDEX_URL = urlresolvers.reverse(
|
||||
INDEX_URL = reverse(
|
||||
constants.URL_PREFIX + 'index')
|
||||
|
||||
|
||||
|
@ -18,9 +18,9 @@ import json
|
||||
import logging
|
||||
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django import http
|
||||
from django.http import HttpResponse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views import generic
|
||||
|
@ -3,6 +3,7 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
python-monascaclient>=1.8.0 # Apache-2.0
|
||||
Django<2.0,>=1.11 # BSD
|
||||
Django<2;python_version<'3.0' # BSD
|
||||
Django<2.1;python_version>='3.0' # BSD
|
||||
horizon>=13.0.0 # Apache-2.0
|
||||
six>=1.10.0 # MIT
|
||||
|
Loading…
Reference in New Issue
Block a user