From f29054558ae4fe245728af5dcda8b425c5a49ecd Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 27 Sep 2021 14:30:47 +0200 Subject: [PATCH 1/2] Fix note render with formattable aliases Signed-off-by: Yohann D'ANELLO --- apps/activity/tables.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/activity/tables.py b/apps/activity/tables.py index a3189a79..2d8e5dcc 100644 --- a/apps/activity/tables.py +++ b/apps/activity/tables.py @@ -1,7 +1,9 @@ # Copyright (C) 2018-2021 by BDE ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later + from django.utils import timezone -from django.utils.html import format_html +from django.utils.html import escape +from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ import django_tables2 as tables from django_tables2 import A @@ -52,8 +54,8 @@ class GuestTable(tables.Table): def render_entry(self, record): if record.has_entry: return str(_("Entered on ") + str(_("{:%Y-%m-%d %H:%M:%S}").format(record.entry.time, ))) - return format_html(''.format(id=record.id, delete_trans=_("remove").capitalize())) + return mark_safe(''.format(id=record.id, delete_trans=_("remove").capitalize())) def get_row_class(record): @@ -91,7 +93,7 @@ class EntryTable(tables.Table): if hasattr(record, 'username'): username = record.username if username != value: - return format_html(value + " aka. " + username) + return mark_safe(escape(value) + " aka. " + escape(username)) return value def render_balance(self, value): From 69b3d2ac9c1448015db67625208dbb5f91bf5529 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 27 Sep 2021 14:51:17 +0200 Subject: [PATCH 2/2] [activity] Fix button shortcut to entries page Signed-off-by: Yohann D'ANELLO --- .../note/templates/note/transaction_form.html | 32 +++++++++++-------- apps/note/views.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/apps/note/templates/note/transaction_form.html b/apps/note/templates/note/transaction_form.html index dc5afbda..bdf047a5 100644 --- a/apps/note/templates/note/transaction_form.html +++ b/apps/note/templates/note/transaction_form.html @@ -10,21 +10,25 @@ SPDX-License-Identifier: GPL-2.0-or-later {# bandeau transfert/crédit/débit/activité #}