Remove deprecated attributes and add alternative methods
data_type_singular and data_type_plural are deprecated. So this patch uses action_present and action_past methods instead of these attributes. In addition this patch fixes cannot login recent horizon. Story: 2001020 Task: 4218 Change-Id: I925c1bd6c66a88da75cdc6e8361f1e8006d9246b Reference: https://docs.openstack.org/developer/horizon/ocata/ref/tables.html#horizon.tables.DeleteAction.data_type_singular
This commit is contained in:
parent
2deb1ca238
commit
fca09aa629
|
@ -14,6 +14,7 @@
|
|||
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
@ -53,8 +54,22 @@ class EditAlarm(tables.LinkAction):
|
|||
class DeleteAlarm(tables.DeleteAction):
|
||||
name = "delete_alarm"
|
||||
verbose_name = _("Delete Alarm Definition")
|
||||
data_type_singular = _("Alarm Definition")
|
||||
data_type_plural = _("Alarm Definitions")
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Alarm Definition",
|
||||
u"Delete Alarm Definitions",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Alarm Definition",
|
||||
u"Deleted Alarm Definitions",
|
||||
count
|
||||
)
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
|
|
@ -19,6 +19,7 @@ from django.core import urlresolvers
|
|||
from django.core.urlresolvers import reverse_lazy
|
||||
from django import template
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
@ -195,8 +196,22 @@ class ShowAlarmDefinition(tables.LinkAction):
|
|||
class DeleteAlarm(tables.DeleteAction):
|
||||
name = "delete_alarm"
|
||||
verbose_name = _("Delete Alarm")
|
||||
data_type_singular = _("Alarm")
|
||||
data_type_plural = _("Alarms")
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Alarm",
|
||||
u"Delete Alarms",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Alarm",
|
||||
u"Deleted Alarms",
|
||||
count
|
||||
)
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
@ -25,8 +26,22 @@ from monitoring.notifications import constants
|
|||
class DeleteNotification(tables.DeleteAction):
|
||||
name = "delete_notification"
|
||||
verbose_name = _("Delete Notification")
|
||||
data_type_singular = _("Notification")
|
||||
data_type_plural = _("Notifications")
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
u"Delete Notification",
|
||||
u"Delete Notifications",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
u"Deleted Notification",
|
||||
u"Deleted Notifications",
|
||||
count
|
||||
)
|
||||
|
||||
def allowed(self, request, datum=None):
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue