From a49f198d2607b20d801abd51f8ccd99b80423b66 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 20 Oct 2025 22:49:37 +0100 Subject: [PATCH] Add render_best_answer method to capitalize first character of best_answer --- sbas/tables.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sbas/tables.py b/sbas/tables.py index 84157c75..a77911b5 100644 --- a/sbas/tables.py +++ b/sbas/tables.py @@ -77,6 +77,15 @@ class QuestionTable(tables.Table): return format_html("
{}
{}", title, mark_safe(value)) return mark_safe(value) + def render_best_answer(self, value, record=None, **kwargs): + """Show only the capitalised first character of the best_answer.""" + if value is None: + return "" + s = str(value).strip() + if not s: + return "" + return s[0].upper() + class UserAnswerTable(tables.Table):