Add render_best_answer method to capitalize first character of best_answer

This commit is contained in:
Ross
2025-10-20 22:49:37 +01:00
parent 8663482a6b
commit a49f198d26
+9
View File
@@ -77,6 +77,15 @@ class QuestionTable(tables.Table):
return format_html("<h5>{}</h5>{}", 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):