From 83a0e432fe475a263c2f5e5337511db96263c3b8 Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Sat, 5 Oct 2019 11:45:04 +0000 Subject: [PATCH] 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 --- manila_ui/dashboards/project/share_snapshots/tables.py | 8 +++++--- manila_ui/dashboards/project/shares/tables.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/manila_ui/dashboards/project/share_snapshots/tables.py b/manila_ui/dashboards/project/share_snapshots/tables.py index 287224b4..f91c3d3b 100644 --- a/manila_ui/dashboards/project/share_snapshots/tables.py +++ b/manila_ui/dashboards/project/share_snapshots/tables.py @@ -15,8 +15,8 @@ from django.template.defaultfilters import title from django.urls import reverse 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 string_concat from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import exceptions @@ -65,8 +65,10 @@ def allowed(self, request, share=None): if not snapshots_allowed: if "disabled" not in self.classes: self.classes = [c for c in self.classes] + ['disabled'] - self.verbose_name = string_concat( - self.verbose_name, ' ', _("(Quota exceeded)")) + self.verbose_name = format_lazy( + '{verbose_name} {quota_exceeded}', + verbose_name=self.verbose_name, + quota_exceeded=_("(Quota exceeded)")) else: self.verbose_name = _("Create Share Snapshot") classes = [c for c in self.classes if c != "disabled"] diff --git a/manila_ui/dashboards/project/shares/tables.py b/manila_ui/dashboards/project/shares/tables.py index b3b571ed..4279f236 100644 --- a/manila_ui/dashboards/project/shares/tables.py +++ b/manila_ui/dashboards/project/shares/tables.py @@ -14,8 +14,8 @@ from django.template.defaultfilters import title from django.urls import reverse +from django.utils.text import format_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 ungettext_lazy from horizon import exceptions @@ -95,8 +95,10 @@ def allowed(self, request, share=None): if not shares_allowed: if "disabled" not in self.classes: self.classes = [c for c in self.classes] + ['disabled'] - self.verbose_name = string_concat(self.verbose_name, ' ', - _("(Quota exceeded)")) + self.verbose_name = format_lazy( + '{verbose_name} {quota_exceeded}', + verbose_name=self.verbose_name, + quota_exceeded=_("(Quota exceeded)")) else: self.verbose_name = _("Create Share") classes = [c for c in self.classes if c != "disabled"]