Add render_best_answer method to capitalize first character of best_answer
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user