Switch from django string_concat to format_lazy
string_concat was removed in django 2.1 when it reached the end
of it's deprecation cycle. It was removed because the same behavior
can be achieved with format_lazy.
For more info. please refer [1].
[1] https://github.com/django/django/blob/master/docs/releases/2.1.txt#L456
Change-Id: I794a62cd39061d9bffe5a1c074bf1ff209d15f21
Closes-Bug: #1846878
(cherry picked from commit 83a0e432fe
)
This commit is contained in:
parent
7f0c6ad276
commit
b1f62a005c
|
@ -15,8 +15,8 @@
|
||||||
from django.template.defaultfilters import title
|
from django.template.defaultfilters import title
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
from django.utils.text import format_lazy
|
||||||
from django.utils.translation import pgettext_lazy
|
from django.utils.translation import pgettext_lazy
|
||||||
from django.utils.translation import string_concat
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ungettext_lazy
|
from django.utils.translation import ungettext_lazy
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
|
@ -65,8 +65,10 @@ class CreateShareSnapshot(tables.LinkAction):
|
||||||
if not snapshots_allowed:
|
if not snapshots_allowed:
|
||||||
if "disabled" not in self.classes:
|
if "disabled" not in self.classes:
|
||||||
self.classes = [c for c in self.classes] + ['disabled']
|
self.classes = [c for c in self.classes] + ['disabled']
|
||||||
self.verbose_name = string_concat(
|
self.verbose_name = format_lazy(
|
||||||
self.verbose_name, ' ', _("(Quota exceeded)"))
|
'{verbose_name} {quota_exceeded}',
|
||||||
|
verbose_name=self.verbose_name,
|
||||||
|
quota_exceeded=_("(Quota exceeded)"))
|
||||||
else:
|
else:
|
||||||
self.verbose_name = _("Create Share Snapshot")
|
self.verbose_name = _("Create Share Snapshot")
|
||||||
classes = [c for c in self.classes if c != "disabled"]
|
classes = [c for c in self.classes if c != "disabled"]
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
from django.template.defaultfilters import title
|
from django.template.defaultfilters import title
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.text import format_lazy
|
||||||
from django.utils.translation import pgettext_lazy
|
from django.utils.translation import pgettext_lazy
|
||||||
from django.utils.translation import string_concat
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ungettext_lazy
|
from django.utils.translation import ungettext_lazy
|
||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
|
@ -95,8 +95,10 @@ class CreateShare(tables.LinkAction):
|
||||||
if not shares_allowed:
|
if not shares_allowed:
|
||||||
if "disabled" not in self.classes:
|
if "disabled" not in self.classes:
|
||||||
self.classes = [c for c in self.classes] + ['disabled']
|
self.classes = [c for c in self.classes] + ['disabled']
|
||||||
self.verbose_name = string_concat(self.verbose_name, ' ',
|
self.verbose_name = format_lazy(
|
||||||
_("(Quota exceeded)"))
|
'{verbose_name} {quota_exceeded}',
|
||||||
|
verbose_name=self.verbose_name,
|
||||||
|
quota_exceeded=_("(Quota exceeded)"))
|
||||||
else:
|
else:
|
||||||
self.verbose_name = _("Create Share")
|
self.verbose_name = _("Create Share")
|
||||||
classes = [c for c in self.classes if c != "disabled"]
|
classes = [c for c in self.classes if c != "disabled"]
|
||||||
|
|
Loading…
Reference in New Issue