Skip to content

Commit 3f7616e

Browse files
committed
fix: Failing invenio-admin due to lazy string
* Flask-admin can not cope with column_labels returning lazy string * As they are used from instances, not from class, this solution changes them to method that use string-returning gettext
1 parent 5ec844d commit 3f7616e

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

invenio_accounts/admin.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,14 @@ class SessionActivityView(ModelView):
159159

160160
list_all = ("user.id", "user.email", "sid_s", "created")
161161

162-
column_labels = {
163-
"user.id": lazy_gettext("User ID"),
164-
"user.email": lazy_gettext("Email"),
165-
"sid_s": lazy_gettext("Session ID"),
166-
}
162+
@property
163+
def column_labels(self):
164+
return {
165+
"user.id": _("User ID"),
166+
"user.email": _("Email"),
167+
"sid_s": _("Session ID"),
168+
}
169+
167170
column_list = list_all
168171
column_filters = list_all
169172
column_sortable_list = list_all
@@ -218,10 +221,12 @@ class UserIdentityView(ModelView):
218221
"user.email",
219222
)
220223

221-
column_labels = {
222-
"user.email": lazy_gettext("Email"),
223-
"id_user": lazy_gettext("User ID"),
224-
}
224+
@property
225+
def column_labels(self):
226+
return {
227+
"user.email": _("Email"),
228+
"id_user": _("User ID"),
229+
}
225230

226231

227232
session_adminview = {

0 commit comments

Comments
 (0)